}
/*
- * cds_lfs_init: initialize lock-free stack.
+ * cds_lfs_init: initialize lock-free stack (with lock). Pair with
+ * cds_lfs_destroy().
*/
static inline
void _cds_lfs_init(struct cds_lfs_stack *s)
assert(!ret);
}
+/*
+ * cds_lfs_destroy: destroy lock-free stack (with lock). Pair with
+ * cds_lfs_init().
+ */
+static inline
+void _cds_lfs_destroy(struct cds_lfs_stack *s)
+{
+ int ret = pthread_mutex_destroy(&s->lock);
+ assert(!ret);
+}
+
static inline
bool ___cds_lfs_empty_head(struct cds_lfs_head *head)
{
if (old_head == head)
break;
}
- return ___cds_lfs_empty_head(head);
+ return !___cds_lfs_empty_head(head);
}
/*