1
|
1 // Dequeue
|
|
2 __code getQueue(struct Context* context, struct Queue* queue, struct Node* node) {
|
|
3 if (queue->first == 0)
|
|
4 return;
|
|
5
|
|
6 struct Element* first = queue->first;
|
|
7 if (__sync_bool_compare_and_swap(&queue->first, first, first->next)) {
|
|
8 queue->count--;
|
|
9
|
|
10 context->next = GetQueue;
|
|
11 stack_push(context->code_stack, &context->next);
|
|
12
|
|
13 context->next = first->task->code;
|
|
14 node->key = first->task->key;
|
|
15
|
|
16 goto meta(context, Get);
|
|
17 } else {
|
|
18 goto meta(context, GetQueue);
|
|
19 }
|
|
20 }
|