Mercurial > hg > Members > innparusu > Gears
view src/parallel_execution/twice.c @ 95:3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 29 Jan 2016 05:36:52 +0900 |
parents | 851da1107223 |
children | 059b26a250cc |
line wrap: on
line source
#include <stdio.h> #include "context.h" #include "origin_cs.h" __code twice(struct Context* context, struct LoopCounter* loopCounter, int index, int prefix, int* array) { int i = loopCounter->i; if (i < prefix) { array[i+index*prefix] = array[i+index*prefix]*2; loopCounter->i++; goto meta(context, Twice); } loopCounter->i = 0; stack_pop(context->code_stack, &context->next); goto meta(context, context->next); } __code twice_stub(struct Context* context) { goto twice(context, &context->data[LoopCounter]->loopCounter, context->data[Node]->node.value->array.index, context->data[Node]->node.value->array.prefix, context->data[Node]->node.value->array.array); }