Mercurial > hg > Members > innparusu > Gears
comparison src/parallel_execution/dependency.c @ 125:77e60b6cdace
Work dependency example
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 27 Sep 2016 17:22:00 +0900 |
parents | acf0453b1c7a |
children |
comparison
equal
deleted
inserted
replaced
124:acf0453b1c7a | 125:77e60b6cdace |
---|---|
52 | 52 |
53 __code checkTaskFinish1(struct Context* context, union Data* data) { | 53 __code checkTaskFinish1(struct Context* context, union Data* data) { |
54 struct Integer* integer = (struct Integer *)data; | 54 struct Integer* integer = (struct Integer *)data; |
55 struct Queue* waitMeTasks = (struct Queue *)(integer + integer->mDataOffset / sizeof(struct Integer)); | 55 struct Queue* waitMeTasks = (struct Queue *)(integer + integer->mDataOffset / sizeof(struct Integer)); |
56 context->next = CheckTaskFinish2; | 56 context->next = CheckTaskFinish2; |
57 waitMeTasks->emptyNext = GetTask; | |
57 goto meta_checkTaskFinish1(context, waitMeTasks, GetQueue1); | 58 goto meta_checkTaskFinish1(context, waitMeTasks, GetQueue1); |
58 } | 59 } |
59 | 60 |
60 __code checkTaskFinish1_stub(struct Context* context) { | 61 __code checkTaskFinish1_stub(struct Context* context) { |
61 goto checkTaskFinish1(context, | 62 goto checkTaskFinish1(context, |
65 /* | 66 /* |
66 * ready input data Gear for waitme task | 67 * ready input data Gear for waitme task |
67 */ | 68 */ |
68 __code checkTaskFinish2(struct Context* context, struct Task* task) { | 69 __code checkTaskFinish2(struct Context* context, struct Task* task) { |
69 // using cas? | 70 // using cas? |
70 // | |
71 if (__sync_fetch_and_sub(&task->idsCount, 1)) { | 71 if (__sync_fetch_and_sub(&task->idsCount, 1)) { |
72 goto meta(context, GetQueue1); | 72 goto meta(context, GetQueue1); |
73 } else { | 73 } else { |
74 goto meta(context, CheckTaskFinish2); | 74 goto meta(context, CheckTaskFinish2); |
75 } | 75 } |