Mercurial > hg > GearsTemplate
changeset 171:747067fe46bd
Fix selected Queue
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 24 Nov 2016 16:29:46 +0900 |
parents | ee7134f3bef1 |
children | 661b0b0d0399 |
files | src/parallel_execution/context.h src/parallel_execution/dependency.c |
diffstat | 2 files changed, 13 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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); -}