Home | History | Annotate | Download | only in internal

Lines Matching refs:queue

7  * A concurrent implementation of a multi-producer, single-consumer queue.  It
15 * The implementation is the simple two-stack queue built on a Treiber stack.
17 * hot code. In fact, we don't really even need queue semantics in any
22 * get faster. Since we're currently providing queue semantics though, we use
35 /* Initialize a queue. */ \
37 a_prefix##new(a_queue_type *queue); \
38 /* Insert all items in src into the queue, clearing src. */ \
40 a_prefix##push_batch(a_queue_type *queue, a_list_type *src); \
41 /* Insert node into the queue. */ \
43 a_prefix##push(a_queue_type *queue, a_type *node); \
45 * Pop all items in the queue into the list at dst. dst should already \
50 a_prefix##pop_batch(a_queue_type *queue, a_list_type *dst);
55 a_prefix##new(a_queue_type *queue) { \
56 atomic_store_p(&queue->tail, NULL, ATOMIC_RELAXED); \
59 a_prefix##push_batch(a_queue_type *queue, a_list_type *src) { \
66 void* cur_tail = atomic_load_p(&queue->tail, ATOMIC_RELAXED); \
69 * Note that this breaks the queue ring structure; \
78 } while (!atomic_compare_exchange_weak_p(&queue->tail, \
83 a_prefix##push(a_queue_type *queue, a_type *node) { \
88 a_prefix##push_batch(queue, &list); \
91 a_prefix##pop_batch(a_queue_type *queue, a_list_type *dst) { \
92 a_type *tail = atomic_load_p(&queue->tail, ATOMIC_RELAXED); \
100 tail = atomic_exchange_p(&queue->tail, NULL, ATOMIC_ACQUIRE); \
102 * It's a single-consumer queue, so if cur started non-NULL, \
110 * this point to make the queue a "real" queue, so do that as \
113 * and make the queue a bag (i.e. not necessarily ordered), but \