Mercurial > hg > Members > innparusu > Gears
view src/parallel_execution/dependency.c @ 116:69fbd905d750
Modify Create_Data
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 12 Jul 2016 16:26:05 +0900 |
parents | 135472238fb7 |
children | c9ab10847fc3 |
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[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[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) { element->data = (union Data *)task; goto meta_spawnTask(context, activeQueue, PutQueue1); /* 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]->task, &context->data[Element]->element, &context->data[ActiveQueue]->queue, &context->data[WaitQueue]->queue); } __code taskA(struct Context* context, struct Integer* input1, struct Integer* input2) { allocator(context); goto meta(context, calcPlus); } __code add(struct Context* context, struct Integer* input1, struct Integer* input2, struct Integer* output) { output->value = input1->value + input2->value; } __code taskB(struct Context* context) { allocator(context); goto meta(context, context->next); } __code mult(struct Context* context, struct Integer* input1, struct Integer* input2, struct Integer* output) { output->value = input1->value * input2->value; }