Fix: add missing destroy functions to queues/stack APIs
[urcu.git] / urcu / static / lfstack.h
index 7afe71e2f0eb82de8944e117666c3bfca484cb65..05d0bb478b8b169a03864272810d1b5c76bfa4f8 100644 (file)
@@ -66,7 +66,8 @@ void _cds_lfs_node_init(struct cds_lfs_node *node)
 }
 
 /*
- * 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)
@@ -79,7 +80,19 @@ void _cds_lfs_init(struct cds_lfs_stack *s)
 }
 
 /*
- * ___cds_lfs_init: initialize lock-free stack.
+ * 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);
+}
+
+/*
+ * ___cds_lfs_init: initialize lock-free stack (without lock).
+ * Don't pair with any destroy function.
  */
 static inline
 void ___cds_lfs_init(struct __cds_lfs_stack *s)
This page took 0.023421 seconds and 4 git commands to generate.