Mercurial > hg > Gears > Gears
changeset 874:7294be69d520
fix
author | ikkun <ikkun@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 23 Jan 2021 18:09:57 +0900 |
parents | b498939a5574 |
children | 9f1b993f5283 |
files | src/parallel_execution/examples/DPP2/AtomicTImpl.cbc src/parallel_execution/examples/DPP2/AtomicT_int.h src/parallel_execution/examples/DPP2/main.cbc |
diffstat | 3 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/examples/DPP2/AtomicTImpl.cbc Sat Jan 23 16:54:26 2021 +0900 +++ b/src/parallel_execution/examples/DPP2/AtomicTImpl.cbc Sat Jan 23 18:09:57 2021 +0900 @@ -14,15 +14,15 @@ } -__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)) { +__code checkAndSet_AtomicT_intImpl(struct AtomicT_intImpl_int* atomicT_int, int oldData, int newData, __code next(...), __code fail(...)) { + if (__sync_bool_compare_and_swap(&atomicT_int->atomic, oldData, newData)) { goto next(...); } goto fail(...); } -__code set_AtomicT_intImpl(struct AtomicT_intImpl_int* atomicT_int, int* ptr, int newData, __code next(...) ) { - *ptr = newData; +__code set_AtomicT_intImpl(struct AtomicT_intImpl_int* atomicT_int, int newData, __code next(...) ) { + atomicT_int->atomic = newData; goto next(...); }
--- a/src/parallel_execution/examples/DPP2/AtomicT_int.h Sat Jan 23 16:54:26 2021 +0900 +++ b/src/parallel_execution/examples/DPP2/AtomicT_int.h Sat Jan 23 18:09:57 2021 +0900 @@ -1,6 +1,6 @@ typedef struct AtomicT_int <>{ - __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 checkAndSet(Impl* atomicT_int, int oldData, int newData, __code next(...), __code fail(...)); + __code set(Impl* atomicT_int ,int newData, __code next(...)); __code next(...); __code fail(...); } AtomicT_int;
--- a/src/parallel_execution/examples/DPP2/main.cbc Sat Jan 23 16:54:26 2021 +0900 +++ b/src/parallel_execution/examples/DPP2/main.cbc Sat Jan 23 18:09:57 2021 +0900 @@ -10,7 +10,7 @@ #interface "Fork.h" #interface "AtomicT_int.h" -int cpu_num = 1; +int cpu_num = 5; int length = 102400; int split = 8; int* array_ptr;