Mercurial > hg > Members > Moririn
view src/parallel_execution/dependency.c @ 148:473b7d990a1f
fix data gears type enum
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 10 Nov 2016 12:07:53 +0900 |
parents | d05b9937aa95 |
children | ea7b11f3e717 |
line wrap: on
line source
#include <stdio.h> #include "context.h" #include "origin_cs.h" __code meta_waitFor(struct Context* context, struct Queue* queue, enum Code next) { context->data[D_Queue] = (union Data *)queue; goto (context->code[next])(context); } __code waitFor1(struct Context* context, struct Task* master, struct Task* slave, struct Element* element) { element->data = (union Data *)slave; // enqueue waitMe goto meta_waitFor(context, master->waitMe, PutQueue1); } __code waitFor1_stub(struct Context* context) { // next think } //__code waitFor2(struct Context* context, struct Task* master, struct Task* slave, struct Element* element) { // element->task = master; // task->next = context->next; // // enqueue waitI // goto meta_waitFor(context, task->waitI, PutQueue1); //} // //__code waitFor2_stub(struct Context* context) { // // next think //} __code meta_spawnTask(struct Context* context, struct Queue* queue, enum Code next) { context->data[D_Queue] = (union Data *)queue; goto (context->code[next])(context); } __code spawnTask(struct Context* context, struct Task* task, struct Element* element, struct Queue* activeQueue, struct Queue* waitQueue) { //printf("spawn Task\n"); element->data = (union Data *)task; if (task->waitI->count == task->idsCount) { //printf("put ActiveQueue\n"); // enqueue activeQueue goto meta_spawnTask(context, activeQueue, PutQueue1); } else { //printf("put WaitQueue\n"); // enqueue waitQueue goto meta_spawnTask(context, waitQueue, PutQueue1); } } __code spawnTask_stub(struct Context* context) { goto spawnTask(context, &context->data[context->dataNum-2]->task, &context->data[D_Element]->element, &context->data[D_ActiveQueue]->queue, &context->data[D_WaitQueue]->queue); } __code taskA(struct Context* context) { printf("TaskA\n"); goto meta(context, context->next); } __code taskB(struct Context* context) { printf("TaskB\n"); goto meta(context, context->next); } __code taskC(struct Context* context) { printf("TaskC\n"); goto meta(context, context->next); }