Mercurial > hg > GearsTemplate
annotate src/synchronizedQueue/synchronizedQueueContext.h @ 38:ce9fde200f3e
Add code segment sender & receiver to synchronizedQueue
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 16 May 2015 02:45:31 +0900 |
parents | 240c045ebab2 |
children | 754c90e96e3d |
rev | line source |
---|---|
36 | 1 /* Context definition for list example */ |
28
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 |
36 | 3 #define ALLOCATE_SIZE 100 |
28
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 enum Code { |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 Code1, |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 Code2, |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 Code3, |
36 | 9 Code4, |
10 Code5, | |
11 Code6, | |
28
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 Allocator, |
38
ce9fde200f3e
Add code segment sender & receiver to synchronizedQueue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
13 Sender, |
28
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 Put, |
38
ce9fde200f3e
Add code segment sender & receiver to synchronizedQueue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
15 Receiver, |
36 | 16 Get, |
28
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 Exit, |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 }; |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 enum UniqueData { |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 Allocate, |
36 | 22 Queue, |
28
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 }; |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 struct Context { |
36 | 26 int codeNum; |
28
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 __code (**code) (struct Context *); |
36 | 28 void* heap_start; |
28
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 void* heap; |
36 | 30 long dataSize; |
31 int dataNum; | |
32 union Data* head; | |
33 union Data** data; | |
28
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 }; |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 union Data { |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 long count; |
36 | 38 struct Queue { |
38
ce9fde200f3e
Add code segment sender & receiver to synchronizedQueue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
39 union Data* first; |
ce9fde200f3e
Add code segment sender & receiver to synchronizedQueue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
40 union Data* last; |
ce9fde200f3e
Add code segment sender & receiver to synchronizedQueue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
41 int count; |
36 | 42 } queue; |
43 struct Element { | |
44 int value; | |
45 union Data* next; | |
46 } element; | |
28
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47 struct Allocate { |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 long size; |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49 enum Code next; |
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 enum Code after_put; |
36 | 51 enum Code after_get; |
28
5d9f74220506
Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
52 } allocate; |
36 | 53 }; |