changeset 846:348d6f20134e

...
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Thu, 21 Jan 2021 17:25:57 +0900
parents feb874340610
children 85adcd76a630
files src/parallel_execution/examples/DPP2/AtomicTImpl.cbc src/parallel_execution/examples/DPP2/AtomicT_int.h src/parallel_execution/examples/DPP2/PhilsImpl.cbc
diffstat 3 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/examples/DPP2/AtomicTImpl.cbc	Thu Jan 21 17:01:16 2021 +0900
+++ b/src/parallel_execution/examples/DPP2/AtomicTImpl.cbc	Thu Jan 21 17:25:57 2021 +0900
@@ -3,25 +3,25 @@
 #include <stdio.h>
 
 AtomicT_int* createAtomicT_intImpl_int(struct Context* context,int init) {
-    struct AtomicT_int* atomic_t  = new AtomicT_int();
+    struct AtomicT_int* atomicT_int  = new AtomicT_int();
     struct AtomicT_intImpl_int* atomic_t_impl = new AtomicT_intImpl_int();
-    atomic_t->atomic_t = (union Data*)atomic_t_impl;
-    atomic_t->checkAndSet = C_checkAndSet_AtomicT_intImpl;
-    atomic_t->set = C_set_AtomicT_intImpl;
+    atomicT_int->atomicT_int = (union Data*)atomic_t_impl;
+    atomicT_int->checkAndSet = C_checkAndSet_AtomicT_intImpl;
+    atomicT_int->set = C_set_AtomicT_intImpl;
     atomic_t_impl->atomic = init;
     atomic_t_impl->init = init;
-    return atomic_t;
+    return atomicT_int;
 
 }
 
-__code checkAndSet_AtomicT_intImpl(struct AtomicT_intImpl_int* atomic_t, int* ptr,int init, int newData, __code next(...), __code fail(...)) {
+__code checkAndSet_AtomicT_intImpl(struct AtomicT_intImpl_int* atomicT_int, int* ptr,int init, int newData, __code next(...), __code fail(...)) {
     if (__sync_bool_compare_and_swap(ptr, init, newData)) {
         goto next(...);
     }
     goto fail(...);
 }
 
-__code set_AtomicT_intImpl(struct AtomicT_intImpl_int* atomic_t, int* ptr, int newData, __code next(...) ) {
+__code set_AtomicT_intImpl(struct AtomicT_intImpl_int* atomicT_int, int* ptr, int newData, __code next(...) ) {
 	*ptr = newData;
    goto next(...);
 }
--- a/src/parallel_execution/examples/DPP2/AtomicT_int.h	Thu Jan 21 17:01:16 2021 +0900
+++ b/src/parallel_execution/examples/DPP2/AtomicT_int.h	Thu Jan 21 17:25:57 2021 +0900
@@ -1,6 +1,6 @@
 typedef struct AtomicT_int <>{
-    __code checkAndSet(Impl* atomic_t,int* ptr ,int init, int newData, __code next(...), __code fail(...));
-    __code set(Impl* atomic_t,int* ptr ,int newData, __code next(...));
+    __code checkAndSet(Impl* atomicT_int,int* ptr ,int init, int newData, __code next(...), __code fail(...));
+    __code set(Impl* atomicT_int,int* ptr ,int newData, __code next(...));
     __code next(...);
     __code fail(...);
 } AtomicT_int;
--- a/src/parallel_execution/examples/DPP2/PhilsImpl.cbc	Thu Jan 21 17:01:16 2021 +0900
+++ b/src/parallel_execution/examples/DPP2/PhilsImpl.cbc	Thu Jan 21 17:25:57 2021 +0900
@@ -34,13 +34,13 @@
 
 __code putdown_lfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) {
     struct AtomicT_int* left_fork = phils->Leftfork;
-    goto left_fork->set(-1, putdown_rfork_PhilsImpl);
+    goto left_fork->set(&phils->self, -1, putdown_rfork_PhilsImpl);
 
 }
 
 __code putdown_rfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) {
     struct AtomicT_int* right_fork = phils->Rightfork;
-    goto right_fork->set(-1, putdown_lfork_PhilsImpl);
+    goto right_fork->set(&phils->self, -1, putdown_lfork_PhilsImpl);
 }
 
 __code thinking_PhilsImpl(struct PhilsImpl* phils, struct Fork* fork, __code next(...)) {
@@ -50,12 +50,12 @@
 
 __code pickup_rfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) {
     struct AtomicT_int* right_fork = phils->Rightfork;
-    goto right_fork->checkAndSet(&phils->id, -1, pickup_lfork, pickup_rfork);
+    goto right_fork->checkAndSet(&phils->self, -1, 0, pickup_lfork, pickup_rfork);
 }
 
 __code pickup_lfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) {
     struct AtomicT_int* left_fork = phils->Leftfork;
-    goto left_fork->checkAndSet(id, -1, pickup_rfork, eating);
+    goto left_fork->checkAndSet(&phils->self, -1, 0, pickup_rfork, eating);
 
 }