comparison src/synchronizedQueue/synchronizedQueueContext.c @ 28:5d9f74220506

Add file synchronizedQueueContext
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Fri, 01 May 2015 18:23:44 +0900
parents
children 240c045ebab2
comparison
equal deleted inserted replaced
26:06fcbe45e85c 28:5d9f74220506
1 #include "synchronizedQueueContext.h"
2
3 extern __code code1(struct Context*);
4 extern __code code2(struct Context*);
5 extern __code code3(struct Context*);
6 extern __code meta(struct Context*);
7 extern __code allocate(struct Context*);
8 extern __code put(struct Context*);
9 extern __code take(struct Context*);
10 extern __code exit_code(struct Context*);
11
12 __code initSynchronizedQueueContext(struct Context* context) {
13 context->codeSize = 3;
14 context->code[Code1] = code1;
15 context->code[Code2] = code2;
16 context->code[Code3] = code3;
17 context->code[Allocator] = allocate;
18 context->code[Put] = put;
19 context->code[Take] = take;
20 context->code[Exit] = exit_code;
21 context->dataSize = 0;
22 context->heap += sizeof(struct Allocate);
23 context->data[Allocate]->list_context = malloc(sizeof(union Data**)*ALLOCATE_SIZE);
24 initListContext(context->data[Allocate]->list_context);
25 }
26
27 __code initListContext(struct ListContext* context) {
28 context->data = malloc(sizeof(union ListData **)*ALLOCATE);
29 context->heap = malloc(sizeof(union ListData *)*ALLOCATE);
30 context->dataSize = 0;
31 }