From: Mathieu Desnoyers Date: Sun, 22 Aug 2010 12:44:41 +0000 (-0400) Subject: wfqueue: provide API for caller-locked dequeue X-Git-Tag: v0.4.7~7 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b0dd35e28adda68dc6a564cf770a5d422d62259f;p=userspace-rcu.git wfqueue: provide API for caller-locked dequeue Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu/wfqueue-static.h b/urcu/wfqueue-static.h index 8a4a7fd..0f7e68f 100644 --- a/urcu/wfqueue-static.h +++ b/urcu/wfqueue-static.h @@ -91,7 +91,7 @@ void _wfq_enqueue(struct wfq_queue *q, struct wfq_node *node) * enqueue. */ struct wfq_node * -__wfq_dequeue_blocking(struct wfq_queue *q) +___wfq_dequeue_blocking(struct wfq_queue *q) { struct wfq_node *node, *next; int attempt = 0; @@ -123,7 +123,7 @@ __wfq_dequeue_blocking(struct wfq_queue *q) if (node == &q->dummy) { _wfq_node_init(node); _wfq_enqueue(q, node); - return __wfq_dequeue_blocking(q); + return ___wfq_dequeue_blocking(q); } return node; } @@ -136,7 +136,7 @@ _wfq_dequeue_blocking(struct wfq_queue *q) ret = pthread_mutex_lock(&q->lock); assert(!ret); - retnode = __wfq_dequeue_blocking(q); + retnode = ___wfq_dequeue_blocking(q); ret = pthread_mutex_unlock(&q->lock); assert(!ret); return retnode; diff --git a/urcu/wfqueue.h b/urcu/wfqueue.h index 3d32b05..5dc64f1 100644 --- a/urcu/wfqueue.h +++ b/urcu/wfqueue.h @@ -57,6 +57,7 @@ struct wfq_queue { #define wfq_node_init _wfq_node_init #define wfq_init _wfq_init #define wfq_enqueue _wfq_enqueue +#define __wfq_dequeue_blocking ___wfq_dequeue_blocking #define wfq_dequeue_blocking _wfq_dequeue_blocking #else /* !_LGPL_SOURCE */ @@ -64,6 +65,8 @@ struct wfq_queue { extern void wfq_node_init(struct wfq_node *node); extern void wfq_init(struct wfq_queue *q); extern void wfq_enqueue(struct wfq_queue *q, struct wfq_node *node); +/* __wfq_dequeue_blocking: caller ensures mutual exclusion between dequeues */ +extern struct wfq_node *__wfq_dequeue_blocking(struct wfq_queue *q); extern struct wfq_node *wfq_dequeue_blocking(struct wfq_queue *q); #endif /* !_LGPL_SOURCE */ diff --git a/wfqueue.c b/wfqueue.c index d22aa7c..182b4a4 100644 --- a/wfqueue.c +++ b/wfqueue.c @@ -43,6 +43,11 @@ void wfq_enqueue(struct wfq_queue *q, struct wfq_node *node) _wfq_enqueue(q, node); } +struct wfq_node *__wfq_dequeue_blocking(struct wfq_queue *q) +{ + return ___wfq_dequeue_blocking(q); +} + struct wfq_node *wfq_dequeue_blocking(struct wfq_queue *q) { return _wfq_dequeue_blocking(q);