# HG changeset patch # User Tatsuki IHA # Date 1484121147 -32400 # Node ID 77faa28128b4a909a5e378592937ad6d2eb72eef # Parent 2454f43923169de97dc9678e0059635aa8f7e078 Add taskSend for TaskManager diff -r 2454f4392316 -r 77faa28128b4 src/parallel_execution/context.h --- a/src/parallel_execution/context.h Mon Jan 09 21:39:33 2017 +0900 +++ b/src/parallel_execution/context.h Wed Jan 11 16:52:27 2017 +0900 @@ -92,7 +92,7 @@ struct Context* contexts; enum Code execute; enum Code taskSend; - enum Code taskRecive; + enum Code taskReceive; enum Code shutdown; struct Queue* tasks; } Worker; diff -r 2454f4392316 -r 77faa28128b4 src/parallel_execution/taskManager.c --- a/src/parallel_execution/taskManager.c Mon Jan 09 21:39:33 2017 +0900 +++ b/src/parallel_execution/taskManager.c Wed Jan 11 16:52:27 2017 +0900 @@ -38,6 +38,15 @@ ); } +__code taskSend(struct Context* context) { + if(loopCounter->i < taskManager->numWorker) { + taskManager->workers[i]->taskSend; + loopCounter->i++; + goto meta(context, C_taskSend); + } + goto meta(context, TaskManager->next); +} + __code shutdownTaskManager(struct Context* context, struct LoopCounter* loopCounter, struct Worker* worker) { int i = loopCounter->i; diff -r 2454f4392316 -r 77faa28128b4 src/parallel_execution/test/queue_test.c --- a/src/parallel_execution/test/queue_test.c Mon Jan 09 21:39:33 2017 +0900 +++ b/src/parallel_execution/test/queue_test.c Wed Jan 11 16:52:27 2017 +0900 @@ -33,7 +33,7 @@ __code queueTest2_stub(struct Context* context) { SingleLinkedQueue* singleLinkedQueue = &context->data[D_Queue]->Queue.queue->Queue.queue->SingleLinkedQueue; - assert(singleLinkedQueue->top->data->Task.code == C_queueTest1); + assert(singleLinkedQueue->top->data->Task.code == C_queueTest2); assert(singleLinkedQueue->last->data->Task.code == C_queueTest1); Task* task = &ALLOCATE(context, Task)->Task; goto queueTest2(context, diff -r 2454f4392316 -r 77faa28128b4 src/parallel_execution/worker.c --- a/src/parallel_execution/worker.c Mon Jan 09 21:39:33 2017 +0900 +++ b/src/parallel_execution/worker.c Wed Jan 11 16:52:27 2017 +0900 @@ -5,13 +5,27 @@ union Data* createWorker(struct Context* context) { struct Worker* worker = &ALLOCATE(context, Worker)->Worker; - // worker->execute = C_executeWorker; - // worker->taskSend = C_taskSendWorker; - // worker->taskRecive = C_taskReciveWorker; - // worker->shutdown = C_shutdownWorker; + worker->execute = C_executeWorker; + worker->taskSend = C_taskSendWorker; + worker->taskReceive = C_taskReceiveWorker; + worker->shutdown = C_shutdownWorker; return (union Data*)(worker); } +__code taskSend(struct Context* context) { +} + +__code exectureWorker(struct Context* context) { + worker->next = worker->taskReceive; + goto meta(context, task->code); +} + +__code taskReceive(struct Context* context) { + queue->queue = (union Data*)worker->worker->Worker.tasks; + queue->next = worker->execute; + goto meta(context, queue->queue->Queue.take); +} + __code getTask1(struct Context* context, struct Queue* queue) { queue->next = C_getTask2; goto meta(context, queue->take);