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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
1 /* Context definition for list example */
28
5d9f74220506 Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
36
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
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
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
9 Code4,
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
10 Code5,
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
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
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
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
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
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
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
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
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
28 void* heap_start;
28
5d9f74220506 Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 void* heap;
36
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
30 long dataSize;
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
31 int dataNum;
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
32 union Data* head;
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
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
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
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
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
42 } queue;
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
43 struct Element {
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
44 int value;
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
45 union Data* next;
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
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
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
51 enum Code after_get;
28
5d9f74220506 Add file synchronizedQueueContext
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 } allocate;
36
240c045ebab2 Add normal queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
53 };