diff src/parallel_execution/generate_context.pl @ 398:fc4fcd441700

Fix spanwTasks
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Tue, 29 Aug 2017 01:01:44 +0900
parents c43ec0e3fa84
children 9b35e6581b5c
line wrap: on
line diff
--- a/src/parallel_execution/generate_context.pl	Thu Aug 24 17:23:41 2017 +0900
+++ b/src/parallel_execution/generate_context.pl	Tue Aug 29 01:01:44 2017 +0900
@@ -150,17 +150,13 @@
     context->data = NEWN(ALLOCATE_SIZE, union Data*);
     context->heapStart = NEWN(context->heapLimit, char);
     context->heap = context->heapStart;
-
     // context->codeNum = Exit;
 
 $code_init
 
 #include "dataGearInit.c"
-
-    // context->data[D_ActiveQueue] = createSynchronizedQueue(context);
-    // context->data[D_WaitQueue]   = createSynchronizedQueue(context);
-
     context->dataNum = D_Worker;
+    context->tasks = createSingleLinkedQueue(context);
 }
 EOFEOF
 
@@ -169,11 +165,10 @@
 
 my $meta_call = <<"EOFEOF";
 __code par_meta(struct Context* context, enum Code spawns, enum Code next) {
-    if (context->contexts != NULL) {
-        context->contexts = NULL;
-        goto (context->code[spawns])(context);
-    }
-    goto (context->code[next])(context);
+    Gearef(context, Queue)->queue = (union Data*)context->tasks;
+    Gearef(context, Queue)->whenEmpty = next;
+    Gearef(context, Queue)->next = spawns;
+    goto (context->code[context->tasks->isEmpty])(context);
 }
 
 __code meta(struct Context* context, enum Code next) {