_cds_lfs_init(s);
}
+void cds_lfs_destroy(struct cds_lfs_stack *s)
+{
+ _cds_lfs_destroy(s);
+}
+
void __cds_lfs_init(struct __cds_lfs_stack *s)
{
___cds_lfs_init(s);
#define cds_lfs_node_init _cds_lfs_node_init
#define cds_lfs_init _cds_lfs_init
+#define cds_lfs_destroy _cds_lfs_destroy
#define __cds_lfs_init ___cds_lfs_init
#define cds_lfs_empty _cds_lfs_empty
#define cds_lfs_push _cds_lfs_push
extern 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 locking). Pair with
+ * cds_lfs_destroy().
*/
extern 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().
+ */
+extern void cds_lfs_destroy(struct cds_lfs_stack *s);
+
+/*
+ * __cds_lfs_init: initialize lock-free stack (without lock).
+ * Don't pair with any destroy function.
*/
extern void __cds_lfs_init(struct __cds_lfs_stack *s);
}
/*
- * 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)
}
/*
- * ___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)
}
/*
- * cds_wfcq_init: initialize wait-free queue.
+ * cds_wfcq_init: initialize wait-free queue (with lock). Pair with
+ * cds_wfcq_destroy().
*/
static inline void _cds_wfcq_init(struct cds_wfcq_head *head,
struct cds_wfcq_tail *tail)
}
/*
- * __cds_wfcq_init: initialize wait-free queue.
+ * cds_wfcq_destroy: destroy wait-free queue (with lock). Pair with
+ * cds_wfcq_init().
+ */
+static inline void _cds_wfcq_destroy(struct cds_wfcq_head *head,
+ struct cds_wfcq_tail *tail)
+{
+ int ret = pthread_mutex_destroy(&head->lock);
+ assert(!ret);
+}
+
+/*
+ * __cds_wfcq_init: initialize wait-free queue (without lock). Don't
+ * pair with any destroy function.
*/
static inline void ___cds_wfcq_init(struct __cds_wfcq_head *head,
struct cds_wfcq_tail *tail)
assert(!ret);
}
+static inline void _cds_wfq_destroy(struct cds_wfq_queue *q)
+{
+ int ret = pthread_mutex_destroy(&q->lock);
+ assert(!ret);
+}
+
static inline void _cds_wfq_enqueue(struct cds_wfq_queue *q,
struct cds_wfq_node *node)
{
}
/*
- * __cds_wfs_init: initialize wait-free stack.
+ * __cds_wfs_init: initialize wait-free stack. Don't pair with
+ * any destroy function.
*/
static inline void ___cds_wfs_init(struct __cds_wfs_stack *s)
{
}
/*
- * cds_wfs_init: initialize wait-free stack.
+ * cds_wfs_init: initialize wait-free stack. Pair with
+ * cds_wfs_destroy().
*/
static inline
void _cds_wfs_init(struct cds_wfs_stack *s)
assert(!ret);
}
+/*
+ * cds_wfs_destroy: destroy wait-free stack. Pair with
+ * cds_wfs_init().
+ */
+static inline
+void _cds_wfs_destroy(struct cds_wfs_stack *s)
+{
+ int ret = pthread_mutex_destroy(&s->lock);
+ assert(!ret);
+}
+
static inline bool ___cds_wfs_end(void *node)
{
return node == CDS_WFS_END;
#define cds_wfcq_node_init _cds_wfcq_node_init
#define cds_wfcq_init _cds_wfcq_init
#define __cds_wfcq_init ___cds_wfcq_init
+#define cds_wfcq_destroy _cds_wfcq_destroy
#define cds_wfcq_empty _cds_wfcq_empty
#define cds_wfcq_enqueue _cds_wfcq_enqueue
extern void cds_wfcq_node_init(struct cds_wfcq_node *node);
/*
- * cds_wfcq_init: initialize wait-free queue.
+ * cds_wfcq_init: initialize wait-free queue. Pair with
+ * cds_wfcq_destroy().
*/
extern void cds_wfcq_init(struct cds_wfcq_head *head,
struct cds_wfcq_tail *tail);
/*
- * __cds_wfcq_init: initialize wait-free queue.
+ * cds_wfcq_destroy: destroy wait-free queue. Pair with
+ * cds_wfcq_init().
+ */
+extern void cds_wfcq_destroy(struct cds_wfcq_head *head,
+ struct cds_wfcq_tail *tail);
+
+/*
+ * __cds_wfcq_init: initialize wait-free queue (without lock). Don't
+ * pair with any destroy function.
*/
extern void __cds_wfcq_init(struct __cds_wfcq_head *head,
struct cds_wfcq_tail *tail);
_cds_wfq_init(q);
}
+static inline CDS_WFQ_DEPRECATED
+void cds_wfq_destroy(struct cds_wfq_queue *q)
+{
+ _cds_wfq_destroy(q);
+}
+
static inline CDS_WFQ_DEPRECATED
void cds_wfq_enqueue(struct cds_wfq_queue *q, struct cds_wfq_node *node)
{
extern CDS_WFQ_DEPRECATED
void cds_wfq_init(struct cds_wfq_queue *q);
+extern CDS_WFQ_DEPRECATED
+void cds_wfq_destroy(struct cds_wfq_queue *q);
+
extern CDS_WFQ_DEPRECATED
void cds_wfq_enqueue(struct cds_wfq_queue *q, struct cds_wfq_node *node);
#define cds_wfs_node_init _cds_wfs_node_init
#define cds_wfs_init _cds_wfs_init
+#define cds_wfs_destroy _cds_wfs_destroy
#define __cds_wfs_init ___cds_wfs_init
#define cds_wfs_empty _cds_wfs_empty
#define cds_wfs_push _cds_wfs_push
extern void cds_wfs_node_init(struct cds_wfs_node *node);
/*
- * cds_wfs_init: initialize wait-free stack.
+ * cds_wfs_init: initialize wait-free stack (with lock). Pair with
+ * cds_wfs_destroy().
*/
extern void cds_wfs_init(struct cds_wfs_stack *s);
/*
- * __cds_wfs_init: initialize wait-free stack.
+ * cds_wfs_destroy: destroy wait-free stack (with lock). Pair with
+ * cds_wfs_init().
+ */
+extern void cds_wfs_destroy(struct cds_wfs_stack *s);
+
+/*
+ * __cds_wfs_init: initialize wait-free stack (no lock). Don't pair with
+ * any destroy function.
*/
extern void __cds_wfs_init(struct __cds_wfs_stack *s);
_cds_wfcq_init(head, tail);
}
+void cds_wfcq_destroy(struct cds_wfcq_head *head,
+ struct cds_wfcq_tail *tail)
+{
+ _cds_wfcq_destroy(head, tail);
+}
+
void __cds_wfcq_init(struct __cds_wfcq_head *head,
struct cds_wfcq_tail *tail)
{
_cds_wfq_init(q);
}
+void cds_wfq_destroy(struct cds_wfq_queue *q)
+{
+ _cds_wfq_destroy(q);
+}
+
void cds_wfq_enqueue(struct cds_wfq_queue *q, struct cds_wfq_node *node)
{
_cds_wfq_enqueue(q, node);
_cds_wfs_init(s);
}
+void cds_wfs_destroy(struct cds_wfs_stack *s)
+{
+ _cds_wfs_destroy(s);
+}
+
void __cds_wfs_init(struct __cds_wfs_stack *s)
{
___cds_wfs_init(s);