diff src/parallel_execution/TaskManagerImpl.cbc @ 282:a3448b0f0a56

Add input data gear
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Sun, 05 Feb 2017 04:08:30 +0900
parents 2c2e4e597eb0
children f1b0cc555b6e
line wrap: on
line diff
--- a/src/parallel_execution/TaskManagerImpl.cbc	Fri Feb 03 18:19:24 2017 +0900
+++ b/src/parallel_execution/TaskManagerImpl.cbc	Sun Feb 05 04:08:30 2017 +0900
@@ -110,7 +110,6 @@
     queue->queue = (union Data*)tasks;
     queue->data = (union Data*)task;
     queue->next = next;
-    pthread_cond_signal(&taskManager->workers[task->workerId]->worker->CPUWorker.cond);
     goto meta(context, tasks->put);
 }
 
@@ -125,18 +124,27 @@
         struct Queue* tasks = taskManagerImpl->workers[i]->tasks;
         queue->queue = (union Data*)tasks;
         queue->data = NULL;
-        queue->next = next;
+        queue->next = C_shutdownTaskManager1;
         goto meta(context, tasks->put);
-        pthread_join(taskManagerImpl->workers[i]->worker->CPUWorker.thread, NULL);
-        loopCounter->i++;
-        goto meta(context, C_shutdownTaskManager);
     }
 
     loopCounter->i = 0;
-    goto meta(context, taskManager->next);
+    goto meta(context, next);
 }
 
 __code shutdownTaskManager_stub(struct Context* context) {
     TaskManagerImpl* taskManagerImpl = (TaskManagerImpl*)GearImpl(context, TaskManager, taskManager);
-    goto shutdownTaskManager(context, Gearef(context, LoopCounter), Gearef(context, TaskManager), taskManagerImpl, Gearef(context, Queue), Gearef(context, TaskManager)->next);
+    goto shutdownTaskManager(context, Gearef(context, LoopCounter), &Gearef(context, TaskManager)->taskManager->TaskManager, taskManagerImpl, Gearef(context, Queue), Gearef(context, TaskManager)->next);
 }
+
+__code shutdownTaskManager1(struct LoopCounter* loopCounter, TaskManagerImpl* taskManagerImpl) {
+    int i = loopCounter->i;
+    pthread_join(taskManagerImpl->workers[i]->worker->CPUWorker.thread, NULL);
+    loopCounter->i++;
+    goto meta(context, C_shutdownTaskManager);
+}
+
+__code shutdownTaskManager1_stub(struct Context* context) {
+    TaskManagerImpl* taskManagerImpl = (TaskManagerImpl*)GearImpl(context, TaskManager, taskManager);
+    goto shutdownTaskManager1(context, Gearef(context, LoopCounter), taskManagerImpl);
+}