Mercurial > hg > Members > Moririn
annotate src/parallel_execution/dependency.c @ 148:473b7d990a1f
fix data gears type enum
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 10 Nov 2016 12:07:53 +0900 |
parents | d05b9937aa95 |
children | ea7b11f3e717 |
rev | line source |
---|---|
112 | 1 #include <stdio.h> |
111 | 2 #include "context.h" |
3 #include "origin_cs.h" | |
4 | |
5 __code meta_waitFor(struct Context* context, struct Queue* queue, enum Code next) { | |
148
473b7d990a1f
fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
114
diff
changeset
|
6 context->data[D_Queue] = (union Data *)queue; |
111 | 7 goto (context->code[next])(context); |
8 } | |
9 | |
10 __code waitFor1(struct Context* context, struct Task* master, struct Task* slave, struct Element* element) { | |
114
d05b9937aa95
Change element data from Task to Data
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
11 element->data = (union Data *)slave; |
111 | 12 // enqueue waitMe |
112 | 13 goto meta_waitFor(context, master->waitMe, PutQueue1); |
111 | 14 } |
15 | |
16 __code waitFor1_stub(struct Context* context) { | |
17 // next think | |
18 } | |
19 | |
112 | 20 //__code waitFor2(struct Context* context, struct Task* master, struct Task* slave, struct Element* element) { |
21 // element->task = master; | |
22 // task->next = context->next; | |
23 // // enqueue waitI | |
24 // goto meta_waitFor(context, task->waitI, PutQueue1); | |
25 //} | |
26 // | |
27 //__code waitFor2_stub(struct Context* context) { | |
28 // // next think | |
29 //} | |
111 | 30 |
112 | 31 __code meta_spawnTask(struct Context* context, struct Queue* queue, enum Code next) { |
148
473b7d990a1f
fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
114
diff
changeset
|
32 context->data[D_Queue] = (union Data *)queue; |
112 | 33 goto (context->code[next])(context); |
111 | 34 } |
35 | |
112 | 36 __code spawnTask(struct Context* context, struct Task* task, struct Element* element, struct Queue* activeQueue, struct Queue* waitQueue) { |
37 //printf("spawn Task\n"); | |
114
d05b9937aa95
Change element data from Task to Data
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
38 element->data = (union Data *)task; |
112 | 39 if (task->waitI->count == task->idsCount) { |
40 //printf("put ActiveQueue\n"); | |
111 | 41 // enqueue activeQueue |
112 | 42 goto meta_spawnTask(context, activeQueue, PutQueue1); |
114
d05b9937aa95
Change element data from Task to Data
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
43 } else { |
112 | 44 //printf("put WaitQueue\n"); |
111 | 45 // enqueue waitQueue |
112 | 46 goto meta_spawnTask(context, waitQueue, PutQueue1); |
111 | 47 } |
48 } | |
49 | |
50 __code spawnTask_stub(struct Context* context) { | |
112 | 51 goto spawnTask(context, |
52 &context->data[context->dataNum-2]->task, | |
148
473b7d990a1f
fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
114
diff
changeset
|
53 &context->data[D_Element]->element, |
473b7d990a1f
fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
114
diff
changeset
|
54 &context->data[D_ActiveQueue]->queue, |
473b7d990a1f
fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
114
diff
changeset
|
55 &context->data[D_WaitQueue]->queue); |
111 | 56 } |
57 | |
112 | 58 __code taskA(struct Context* context) { |
111 | 59 printf("TaskA\n"); |
60 goto meta(context, context->next); | |
61 } | |
62 | |
112 | 63 __code taskB(struct Context* context) { |
111 | 64 printf("TaskB\n"); |
65 goto meta(context, context->next); | |
66 } | |
67 | |
112 | 68 __code taskC(struct Context* context) { |
111 | 69 printf("TaskC\n"); |
70 goto meta(context, context->next); | |
71 } |