Mercurial > hg > GearsTemplate
changeset 209:5708390a9d88
fix compile errors
author | mir3636 |
---|---|
date | Wed, 21 Dec 2016 22:13:57 +0900 |
parents | b6ffdd99e525 |
children | ba56dab79dc4 |
files | src/parallel_execution/TaskManager.c src/parallel_execution/test/queue_test.c |
diffstat | 2 files changed, 37 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/TaskManager.c Tue Dec 20 19:39:51 2016 +0900 +++ b/src/parallel_execution/TaskManager.c Wed Dec 21 22:13:57 2016 +0900 @@ -5,14 +5,13 @@ #include <stdio.h> union Data* createTaskManager(struct Context* context) { - struct TaskManager* taskManager = &ALLOCATE(context, TaskManager)->taskManager; - struct TaskManager* taskManagerImpl = &ALLOCATE(context, TaskManagerImpl)->taskManagerImpl; - taskManagerImpl -> activeQueue = createSynchronizedQueue(context); - taskManagerImpl -> waitQueue = createSynchronizedQueue(context); - taskManager->taskManager = (union Data*)taskManagerImpl; + struct TaskManager* taskManager = &ALLOCATE(context, TaskManager)->TaskManager; + struct TaskManagerImpl* taskManagerImpl = &ALLOCATE(context, TaskManagerImpl)->TaskManagerImpl; + taskManagerImpl -> activeQueue = (struct Queue*)createSynchronizedQueue(context); + taskManagerImpl -> taskQueue = (struct Queue*)createSynchronizedQueue(context); taskManager->spawn = C_spawnTaskManager; taskManager->shutdown = C_shutdownTaskManager; - taskManager->deadLockDetected = C_deadLockDetected; + // taskManager->deadLockDetected = C_deadLockDetected; return (union Data*)(taskManager); } @@ -26,34 +25,35 @@ } queue->data = element->data; queue->next = context->next; - goto meta(context, queue->queue->put); + goto meta(context, queue->queue->Queue.put); } __code spawnTaskManager_stub(struct Context* context) { - goto spawnTask(context, - context->data[D_Element]->element.data, - &context->data[D_Element]->element, - &context->data[D_ActiveQueue]->Queue, - &context->data[D_WaitQueue]->Queue); + goto spawnTaskManager(context, + context->data[D_Element]->Element.data, + &context->data[D_Element]->Element, + &context->data[D_Queue]->Queue, + context->data[D_TaskManagerImpl]->TaskManagerImpl.activeQueue, + context->data[D_TaskManagerImpl]->TaskManagerImpl.taskQueue); } __code shutdownTaskManager(struct Context* context, struct LoopCounter* loopCounter, struct Worker* worker) { int i = loopCounter->i; - if (i < worker->num) { + if (i < worker->id) { pthread_join(worker->contexts[i].thread, NULL); loopCounter->i++; - goto meta(context, TaskManager); + goto meta(context, C_taskManager); } loopCounter->i = 0; Time *t = &context->data[D_Time]->Time; t->next = C_code2; - goto meta(context, EndTime); + goto meta(context, C_end_time); } __code shutdownTaskManager_stub(struct Context* context) { - goto shutdownTaskManager(context, &context->data[D_LoopCounter]->loopCounter, &context->data[D_Worker]->worker); + goto shutdownTaskManager(context, &context->data[D_LoopCounter]->loopCounter, &context->data[D_Worker]->Worker); }
--- a/src/parallel_execution/test/queue_test.c Tue Dec 20 19:39:51 2016 +0900 +++ b/src/parallel_execution/test/queue_test.c Wed Dec 21 22:13:57 2016 +0900 @@ -4,66 +4,66 @@ #include <assert.h> -__code queue_test1(struct Context* context, struct Task* task, struct Queue* queue) { - task->code = C_queue_test1; - queue->next = C_queue_test2; +__code queueTest1(struct Context* context, struct Task* task, struct Queue* queue) { + task->code = C_queueTest1; + queue->next = C_queueTest2; queue->data = (union Data*)task; goto meta(context, queue->queue->Queue.put); } -__code queue_test1_stub(struct Context* context) { +__code queueTest1_stub(struct Context* context) { Task* task = &ALLOCATE(context, Task)->Task; struct Queue* queue = &(createSingleLinkedQueue(context)->Queue); assert(queue->queue->SingleLinkedQueue.top == NULL); assert(queue->queue->SingleLinkedQueue.last == NULL); context->data[D_Queue]->Queue.queue = (union Data*)queue; - goto queue_test1(context, + goto queueTest1(context, task, &context->data[D_Queue]->Queue.queue); } -__code queue_test2(struct Context* context, struct Task* task, struct Queue* queue) { - task->code = C_queue_test2; - queue->next = C_queue_test3; +__code queueTest2(struct Context* context, struct Task* task, struct Queue* queue) { + task->code = C_queueTest2; + queue->next = C_queueTest3; queue->data = (union Data*)task; goto meta(context, queue->queue->Queue.put); } -__code queue_test2_stub(struct Context* context) { +__code queueTest2_stub(struct Context* context) { // assert(((struct Task)context->data[D_Queue]->queue.queue->queue.queue->singleLinkedQueue.top->data)->code == C_QueueTest1) // assert(((struct Task)context->data[D_Queue]->queue.queue->queue.queue->singleLinkedQueue.top->data)->code == C_QueueTest1) Task* task = &ALLOCATE(context, Task)->Task; - goto queue_test2(context, + goto queueTest2(context, task, &context->data[D_Queue]->Queue.queue); } -__code queue_test3(struct Context* context, struct Queue* queue) { - queue->next = C_queue_test4; +__code queueTest3(struct Context* context, struct Queue* queue) { + queue->next = C_queueTest4; goto meta(context, queue->queue->Queue.take); } -__code queue_test3_stub(struct Context* context) { +__code queueTest3_stub(struct Context* context) { // assert(((struct Task)context->data[D_Queue]->queue.queue->queue.queue->singleLinkedQueue.top->data)->code == C_QueueTest2) // assert(((struct Task)context->data[D_Queue]->queue.queue->queue.queue->singleLinkedQueue.top->data)->code == C_QueueTest1) - goto queue_test3(context, + goto queueTest3(context, &context->data[D_Queue]->Queue); } -__code queue_test4(struct Context* context, struct Queue* queue) { - goto meta(context, C_queue_test4 /*Exit*/ ); +__code queueTest4(struct Context* context, struct Queue* queue) { + goto meta(context, C_queueTest4 /*Exit*/ ); } -__code queue_test4_stub(struct Context* context) { -// assert(((struct Task)context->data[D_Queue]->queue.queue.data)->code == C_queue_test1) -// assert(((struct Task)context->data[D_Queue]->queue.queue.last->data)->code == C_queue_test2) - goto queue_test4(context, +__code queueTest4_stub(struct Context* context) { +// assert(((struct Task)context->data[D_Queue]->queue.queue.data)->code == C_queueTest1) +// assert(((struct Task)context->data[D_Queue]->queue.queue.last->data)->code == C_queueTest2) + goto queueTest4(context, &context->data[D_Queue]->Queue.queue); } int main(int argc, char const* argv[]) { struct Context* main_context = NEW(struct Context); initContext(main_context); - main_context->next = C_queue_test1; + main_context->next = C_queueTest1; goto start_code(main_context); }