X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=impatomic.cc;h=391ce2aa159cea4b6e103d074c6cb5eb53032dfd;hb=HEAD;hp=2d48989c147d051bd61d3a4d01fe0e2ba1bcf9ea;hpb=e7c0c2dc248559b307122db7923df35f7c6d957e;p=c11tester.git diff --git a/impatomic.cc b/impatomic.cc index 2d48989c..391ce2aa 100644 --- a/impatomic.cc +++ b/impatomic.cc @@ -8,8 +8,8 @@ namespace std { bool atomic_flag_test_and_set_explicit ( volatile atomic_flag * __a__, memory_order __x__ ) { volatile bool * __p__ = &((__a__)->__f__); - bool result = (bool) model->switch_to_master(new ModelAction(ATOMIC_RMWR, __x__, (void *) __p__)); - model->switch_to_master(new ModelAction(ATOMIC_RMW, __x__, (void *) __p__, true)); + bool result = (bool) model->switch_thread(new ModelAction(ATOMIC_RMWR, __x__, (void *) __p__)); + model->switch_thread(new ModelAction(ATOMIC_RMW, __x__, (void *) __p__, true)); return result; } @@ -17,20 +17,24 @@ bool atomic_flag_test_and_set( volatile atomic_flag* __a__ ) { return atomic_flag_test_and_set_explicit( __a__, memory_order_seq_cst ); } void atomic_flag_clear_explicit -( volatile atomic_flag* __a__, memory_order __x__ ) + ( volatile atomic_flag* __a__, memory_order __x__ ) { volatile bool * __p__ = &((__a__)->__f__); - model->switch_to_master(new ModelAction(ATOMIC_WRITE, __x__, (void *) __p__, false)); + model->switch_thread(new ModelAction(ATOMIC_WRITE, __x__, (void *) __p__, false)); } void atomic_flag_clear( volatile atomic_flag* __a__ ) { atomic_flag_clear_explicit( __a__, memory_order_seq_cst ); } -void __atomic_flag_wait__( volatile atomic_flag* __a__ ) -{ while ( atomic_flag_test_and_set( __a__ ) ); } +void __atomic_flag_wait__( volatile atomic_flag* __a__ ) { + while ( atomic_flag_test_and_set( __a__ ) ) + ; +} void __atomic_flag_wait_explicit__( volatile atomic_flag* __a__, - memory_order __x__ ) -{ while ( atomic_flag_test_and_set_explicit( __a__, __x__ ) ); } + memory_order __x__ ) { + while ( atomic_flag_test_and_set_explicit( __a__, __x__ )) + ; +} }