Mercurial > hg > Papers > 2017 > ikkun-sigos
view paper/src/sync_dequeue.c @ 10:a7d96c2f588b
Update
author | one |
---|---|
date | Sat, 22 Apr 2017 16:51:58 +0900 |
parents | 38b037c42c34 |
children |
line wrap: on
line source
// Dequeue __code getQueue(struct Context* context, struct Queue* queue, struct Node* node) { if (queue->first == 0) return; struct Element* first = queue->first; if (__sync_bool_compare_and_swap(&queue->first, first, first->next)) { queue->count--; context->next = GetQueue; stack_push(context->code_stack, &context->next); context->next = first->task->code; node->key = first->task->key; goto meta(context, Get); } else { goto meta(context, GetQueue); } }