[lttng-dev] [URCU PATCH 1/3] wfcqueue: implement concurrency-efficient queue

Paolo Bonzini pbonzini at redhat.com
Mon Oct 8 11:47:10 EDT 2012


Il 02/10/2012 16:14, Mathieu Desnoyers ha scritto:
> +/*
> + * Concurrent queue with wait-free enqueue/blocking dequeue.
> + *
> + * Inspired from half-wait-free/half-blocking queue implementation done by
> + * Paul E. McKenney.
> + *
> + * Mutual exclusion of __cds_wfcq_* API
> + *
> + * Unless otherwise stated, the caller must ensure mutual exclusion of
> + * queue update operations "dequeue" and "splice" (for source queue).
> + * Queue read operations "first" and "next" need to be protected against
> + * concurrent "dequeue" and "splice" (for source queue) by the caller.
> + * "enqueue", "splice" (for destination queue), and "empty" are the only
> + * operations that can be used without any mutual exclusion.
> + * Mutual exclusion can be ensured by holding cds_wfcq_dequeue_lock().
> + *
> + * For convenience, cds_wfcq_dequeue_blocking() and
> + * cds_wfcq_splice_blocking() hold the dequeue lock.
> + */

Hi,

can you add a for-like macro for iteration?  Iteration does not require
holding the lock and assumes that you are the sole user of the data
structure, which is useful together with splice.

Paolo



More information about the lttng-dev mailing list