Mercurial > hg > GearsTemplate
view src/parallel_execution/worker.c @ 103:6402a33250a6
remove stack from getQueue
author | ikkun |
---|---|
date | Wed, 02 Mar 2016 21:19:01 +0900 |
parents | 8987cf13d5bb |
children | 059b26a250cc |
line wrap: on
line source
#include <libkern/OSAtomic.h> #include "context.h" #include "origin_cs.h" __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)) { if (OSAtomicCompareAndSwapPtr(first, first->next, (void*)&queue->first)) { queue->count--; context->next = GetQueue; stack_push(context->code_stack, &context->next); context->next = first->task->code; node->key = first->task->key; struct Traverse *t = &context->data[Traverse]->traverse; t->next = GetQueue; goto meta(context, Get); } else { goto meta(context, GetQueue); } } __code getQueue_stub(struct Context* context) { goto getQueue(context, &context->data[ActiveQueue]->queue, &context->data[Node]->node); } #ifdef USE_CUDA __code twiceGpu(struct Context* context) { cuMemcpyHtoDAsync(context,context,context,context->stream); cuLaunchkanel(); cuMemcpyDtoHAsync(); } #endif