# HG changeset patch # User Tatsuki IHA # Date 1479972586 -32400 # Node ID 747067fe46bde7077ac43b6fbc639fe1baf874b4 # Parent ee7134f3bef1ab064d3ea843e05c5d50d6abc27d Fix selected Queue diff -r ee7134f3bef1 -r 747067fe46bd src/parallel_execution/context.h --- a/src/parallel_execution/context.h Tue Nov 22 10:36:45 2016 +0900 +++ b/src/parallel_execution/context.h Thu Nov 24 16:29:46 2016 +0900 @@ -129,6 +129,7 @@ D_Allocate, D_SingleLinkedStack, D_Stack, + D_RedBlackTree, D_Tree, D_Task, D_Traverse, @@ -139,6 +140,8 @@ D_Element, D_ActiveQueue, D_WaitQueue, + D_SingleLinkedQueue, + D_SynchronizedQueue, D_Queue }; @@ -243,6 +246,7 @@ enum Code put; enum Code get; enum Code remove; + enum Code clear; enum Code next; } Tree; struct Traverse { @@ -288,11 +292,13 @@ typedef struct Task Task; typedef struct Queue Queue; typedef struct SingleLinkedQueue SingleLinkedQueue; +typedef struct SynchronizedQueue SynchronizedQueue; typedef struct Stack Stack; typedef struct SingleLinkedStack SingleLinkedStack; typedef struct ArrayStack ArrayStack; typedef struct Element Element; typedef struct Array Array; +typedef struct RedBlackTree RedBlackTree; typedef struct Tree Tree; typedef struct Traverse Traverse; typedef struct RotateTree RotateTree; diff -r ee7134f3bef1 -r 747067fe46bd src/parallel_execution/dependency.c --- a/src/parallel_execution/dependency.c Tue Nov 22 10:36:45 2016 +0900 +++ b/src/parallel_execution/dependency.c Thu Nov 24 16:29:46 2016 +0900 @@ -33,38 +33,23 @@ goto meta(context, context->next); } -__code spawnTask(struct Context* context, struct Element* element, struct Queue* activeQueue, struct Queue* waitQueue) { - struct Queue *queue; +__code spawnTask(struct Context* context, struct Task* task, struct Element* element, struct Queue* queue, struct Queue* activeQueue, struct Queue* waitQueue) { if (task->idsCount == 0) { // enqueue activeQueue - queue = activeQueue; + queue->queue = (union Data*)activeQueue; } else { // enqueue waitQueue - queue = waitQueue; + queue->queue = (union Data*)waitQueue; } queue->data = element->data; queue->next = context->next; - goto meta_spawnTask(context, queue, queue->put); + goto meta(context, queue->queue->put); } __code spawnTask_stub(struct Context* context) { goto spawnTask(context, + context->data[D_Element]->element.data, &context->data[D_Element]->element, - &context->data[D_ActiveQueue]->queue, - &context->data[D_WaitQueue]->queue); -} - -__code taskA(struct Context* context) { - printf("TaskA\n"); - goto meta(context, context->next); + &context->data[D_ActiveQueue]->Queue, + &context->data[D_WaitQueue]->Queue); } - -__code taskB(struct Context* context) { - printf("TaskB\n"); - goto meta(context, context->next); -} - -__code taskC(struct Context* context) { - printf("TaskC\n"); - goto meta(context, context->next); -}