Mercurial > hg > Papers > 2023 > soto-master
view Paper/src/sync_dequeue.c @ 1:a72446879486
Init paper
author | soto <soto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 12 Jan 2023 20:28:50 +0900 |
parents | |
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); } }