diff src/parallel_execution/dependency.c @ 169:ea7b11f3e717

Using Queue Interface
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Tue, 22 Nov 2016 09:48:37 +0900
parents 473b7d990a1f
children 747067fe46bd
line wrap: on
line diff
--- a/src/parallel_execution/dependency.c	Tue Nov 22 04:21:11 2016 +0900
+++ b/src/parallel_execution/dependency.c	Tue Nov 22 09:48:37 2016 +0900
@@ -30,26 +30,25 @@
 
 __code meta_spawnTask(struct Context* context, struct Queue* queue, enum Code next) {
     context->data[D_Queue] = (union Data *)queue;
-    goto (context->code[next])(context);
+    goto meta(context, context->next);
 }
 
-__code spawnTask(struct Context* context, struct Task* task, struct Element* element, struct Queue* activeQueue, struct Queue* waitQueue) {
-    //printf("spawn Task\n");
-    element->data = (union Data *)task;
-    if (task->waitI->count == task->idsCount) {
-        //printf("put ActiveQueue\n");
+__code spawnTask(struct Context* context, struct Element* element, struct Queue* activeQueue, struct Queue* waitQueue) {
+    struct Queue *queue;
+    if (task->idsCount == 0) {
         // enqueue activeQueue
-        goto meta_spawnTask(context, activeQueue, PutQueue1);
+        queue = activeQueue;
     } else {
-        //printf("put WaitQueue\n");
         // enqueue waitQueue
-        goto meta_spawnTask(context, waitQueue, PutQueue1);
+        queue = waitQueue;
     }
+    queue->data = element->data;
+    queue->next = context->next;
+    goto meta_spawnTask(context, queue, queue->put);
 }
 
 __code spawnTask_stub(struct Context* context) {
     goto spawnTask(context,
-            &context->data[context->dataNum-2]->task,
             &context->data[D_Element]->element,
             &context->data[D_ActiveQueue]->queue,
             &context->data[D_WaitQueue]->queue);