diff src/synchronizedQueue/synchronizedQueueContext.c @ 39:754c90e96e3d

Add synchronizedQueue. it use pthread_mutex_lock, unlock
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Sat, 16 May 2015 20:17:58 +0900
parents ce9fde200f3e
children 46917f503bce
line wrap: on
line diff
--- a/src/synchronizedQueue/synchronizedQueueContext.c	Sat May 16 02:45:31 2015 +0900
+++ b/src/synchronizedQueue/synchronizedQueueContext.c	Sat May 16 20:17:58 2015 +0900
@@ -8,6 +8,7 @@
 extern __code code4(struct Context*);
 extern __code code5(struct Context*);
 extern __code code6(struct Context*);
+extern __code code7(struct Context*);
 extern __code meta(struct Context*);
 extern __code allocate(struct Context*);
 extern __code sender(struct Context*);
@@ -29,6 +30,7 @@
     context->code[Code4]     = code4;
     context->code[Code5]     = code5;
     context->code[Code6]     = code6;
+    context->code[Code7]     = code7;
     context->code[Allocator] = allocate;
     context->code[Sender]    = sender;
     context->code[Put]       = put;
@@ -44,6 +46,7 @@
     context->data[Queue]    = context->heap;
     context->heap          += sizeof(struct Queue);
     context->data[Queue]->queue.first = 0;
+    pthread_mutex_init(&context->data[Queue]->queue.mutex, NULL);
 
     context->dataNum = Queue;
 }