Mercurial > hg > Gears > GearsAgda
view src/parallel_execution/dependency.c @ 164:b0c6e0392b00
Add comment to stack.agda
author | atton |
---|---|
date | Thu, 17 Nov 2016 18:28:13 +0000 |
parents | 473b7d990a1f |
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); }