# HG changeset patch # User Tatsuki IHA # Date 1514458468 -32400 # Node ID 39b5df2d1c93fd5989abb448d95d6f737ac687eb # Parent b8b412a7670aa6005f474cb14522f8539ec75145 Change loopCounter type from struct LoopCounter to Integer for TaskManagerImpl diff -r b8b412a7670a -r 39b5df2d1c93 src/parallel_execution/TaskManagerImpl.cbc --- a/src/parallel_execution/TaskManagerImpl.cbc Thu Dec 28 19:51:06 2017 +0900 +++ b/src/parallel_execution/TaskManagerImpl.cbc Thu Dec 28 19:54:28 2017 +0900 @@ -30,8 +30,7 @@ taskManagerImpl->sendGPUWorkerIndex = taskManagerImpl->gpu; taskManagerImpl->sendCPUWorkerIndex = taskManagerImpl->cpu; taskManagerImpl->taskCount = 0; - taskManagerImpl->loopCounter = new LoopCounter(); - taskManagerImpl->loopCounter -> i = 0; + taskManagerImpl->loopCounter = 0; createWorkers(context, taskManagerImpl); taskManager->taskManager = (union Data*)taskManagerImpl; return taskManager; @@ -114,13 +113,13 @@ } __code setWaitTaskTaskManagerImpl(struct TaskManagerImpl* taskManager, struct Context* task, __code next(...)) { - int i = taskManager->loopCounter->i; + int i = taskManager->loopCounter; if(task->idg+i < task->maxIdg) { struct Queue* queue = GET_WAIT_LIST(task->data[task->idg + i]); - taskManager->loopCounter->i++; + taskManager->loopCounter++; goto queue->put(task, setWaitTaskTaskManagerImpl); } - taskManager->loopCounter->i = 0; + taskManager->loopCounter = 0; struct Queue* queue = taskManager->taskQueue; goto queue->put(task, incrementTaskCountTaskManagerImpl); } @@ -181,28 +180,28 @@ usleep(1000); goto shutdownTaskManagerImpl(); } - int i = taskManager->loopCounter->i; + int i = taskManager->loopCounter; if (i < taskManager->numWorker) { struct Queue* tasks = taskManager->workers[i]->tasks; goto tasks->put(NULL, shutdownTaskManagerImpl1); } - taskManager->loopCounter->i = 0; + taskManager->loopCounter = 0; goto shutdownTaskManagerImpl2(); } __code shutdownTaskManagerImpl1(struct TaskManagerImpl* taskManager, __code next(...)) { - taskManager->loopCounter->i++; + taskManager->loopCounter++; goto shutdownTaskManagerImpl(); } __code shutdownTaskManagerImpl2(struct TaskManagerImpl* taskManager, __code next(...)) { - int i = taskManager->loopCounter->i; + int i = taskManager->loopCounter; if (i < taskManager->numWorker) { pthread_join(taskManager->workers[i]->thread, NULL); - taskManager->loopCounter->i++; + taskManager->loopCounter++; goto shutdownTaskManagerImpl2(); } - taskManager->loopCounter->i = 0; + taskManager->loopCounter = 0; goto next(...); } diff -r b8b412a7670a -r 39b5df2d1c93 src/parallel_execution/context.h --- a/src/parallel_execution/context.h Thu Dec 28 19:51:06 2017 +0900 +++ b/src/parallel_execution/context.h Thu Dec 28 19:54:28 2017 +0900 @@ -169,7 +169,7 @@ struct Queue* activeQueue; struct Queue* taskQueue; struct Worker** workers; - struct LoopCounter* loopCounter; + int loopCounter; int cpu; int gpu; int io;