Mercurial > hg > GearsTemplate
view src/parallel_execution/examples/boundedBuffer/producer.cbc @ 509:62a77785cb2b
Bounded Loop for boundedBuffer examples
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 04 Jan 2018 19:50:46 +0900 |
parents | d8b2036c6942 |
children | c31912aaa378 |
line wrap: on
line source
#include "../../../context.h" #interface "Buffer.h" __code producer(struct Buffer* buffer, Int length, __code next(...), struct LoopCounter* loopCounter) { int i = loopCounter->i; if (i < length) { Node* node = new Node(); node->value = (union Data*)new Int(); node->value->Int = i; loopCounter->i++; goto buffer->put(node, producer); } goto next(...); } __code producer_stub(struct Context* context) { goto producer(context, &context->data[context->idg]->Buffer, context->data[context->idg+1]->Int, context->next, Gearef(context, LoopCounter)); }