diff src/synchronizedQueue/synchronizedQueue.c @ 66:a870c84acd0e

Change synchronizedQueue allocator from __code to Function call
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Tue, 15 Sep 2015 15:21:50 +0900
parents 2a40d697bf4e
children 5c3db1bef268
line wrap: on
line diff
--- a/src/synchronizedQueue/synchronizedQueue.c	Tue Jul 14 15:59:41 2015 +0900
+++ b/src/synchronizedQueue/synchronizedQueue.c	Tue Sep 15 15:21:50 2015 +0900
@@ -14,27 +14,21 @@
 #define NUM 100
 
 extern __code initSynchronizedQueueContext(struct Context* context);
-
-//__code code1(struct Context* context) {
-//    context->data[Allocate]->allocate.size = sizeof(struct Element);
-//    context->data[Allocate]->allocate.next = Code2;
-//    goto meta(context, Allocator);
-//}
+extern void allocator(struct Context* context);
 
 __code meta(struct Context* context, enum Code next) {
     goto (context->code[next])(context);
 }
 
-//__code code2(struct Context* context) {
-//    context->data[Allocate]->allocate.after_put = Code3;
-//    context->data[context->dataNum] -> element.value = 1024;
-//    goto meta(context, Sender);
+//__code code1(struct Context* context) {
+//    context->data[Allocate]->allocate.size = sizeof(struct Element);
+//    goto code2(context);
 //}
 
 __code code1(struct Context* context, struct Allocate* allocate) {
     allocate->size = sizeof(long);
-    allocate->next = Code2;
-    goto meta(context, Allocator);
+    allocator(context);
+    goto meta(context, Code2);
 }
 
 __code code1_stub(struct Context* context) {
@@ -56,8 +50,8 @@
         goto meta(context, ThreadExit);
     }
     allocate->size = sizeof(struct Element);
-    allocate->next = Code4;
-    goto meta(context, Allocator);
+    allocator(context);
+    goto meta(context, Code4);
 }
 
 __code code3_stub(struct Context* context) {
@@ -115,8 +109,8 @@
 
 __code code5(struct Context* context, struct Allocate* allocate) {
     allocate->size = sizeof(long);
-    allocate->next = Code6;
-    goto meta(context, Allocator);
+    allocator(context);
+    goto meta(context, Code6);
 }
 
 __code code5_stub(struct Context* context) {