Mercurial > hg > Members > Moririn
view src/parallel_execution/TaskIterator.cbc @ 468:ac244346c85d
Change used interface syntax from #include to #interface
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 Dec 2017 18:10:56 +0900 |
parents | 8d7e5d48cad3 |
children |
line wrap: on
line source
#include "../context.h" #interface "Iterator.h" #include <stdio.h> createTaskIterator(struct Context, struct List list) { struct Iterator* iterator = new Iterator(); struct TaskIterator* taskIterator = new TaskIterator(); iterator->itearot = (union Data*)taskIterator; iterator->exec = C_execTaskIterator; iterator->barrier = C_barrierTaskIterator; taskIterator->taskList = list; } __code execTaskIterator(struct taskIterator* iterator, struct TaskManager* taskManager, struct Context* task, __code next(...)) { if (iterator->list->next == null) { goto next(...); } iterator->list = list->next; struct Context* task = (struct Context*)iterator->list->data; struct TaskManager taskManager = task->taskManager; taskManager->spawn(task, C_execTaskIterator); } __code barrierTaskIterator(struct MultiDimIterator* iterator, struct Context* task, __code next(...), __code whenWait(...)) { if (__sync_fetch_and_sub(&iterator->count, 1) == 1) { goto next(...); } goto whenWait(...); }