From mboxrd@z Thu Jan 1 00:00:00 1970 From: pbonzini@redhat.com (Paolo Bonzini) Date: Mon, 08 Oct 2012 17:47:10 +0200 Subject: [lttng-dev] [URCU PATCH 1/3] wfcqueue: implement concurrency-efficient queue In-Reply-To: <20121002141444.GB4057@Krystal> References: <20121002141307.GA4057@Krystal> <20121002141444.GB4057@Krystal> Message-ID: <5072F57E.4020308@redhat.com> 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