4 #include "threads-model.h"
8 bool atomic_flag_test_and_set_explicit ( volatile atomic_flag * __a__, memory_order __x__ ) {
9 volatile bool * __p__ = &((__a__)->__f__);
10 bool result = (bool) model->switch_to_master(new ModelAction(ATOMIC_RMWR, __x__, (void *) __p__));
11 model->switch_to_master(new ModelAction(ATOMIC_RMW, __x__, (void *) __p__, true));
15 bool atomic_flag_test_and_set( volatile atomic_flag* __a__ )
16 { return atomic_flag_test_and_set_explicit( __a__, memory_order_seq_cst ); }
18 void atomic_flag_clear_explicit
19 ( volatile atomic_flag* __a__, memory_order __x__ )
21 volatile bool * __p__ = &((__a__)->__f__);
22 model->switch_to_master(new ModelAction(ATOMIC_WRITE, __x__, (void *) __p__, false));
25 void atomic_flag_clear( volatile atomic_flag* __a__ )
26 { atomic_flag_clear_explicit( __a__, memory_order_seq_cst ); }
28 void __atomic_flag_wait__( volatile atomic_flag* __a__ )
29 { while ( atomic_flag_test_and_set( __a__ ) ); }
31 void __atomic_flag_wait_explicit__( volatile atomic_flag* __a__,
33 { while ( atomic_flag_test_and_set_explicit( __a__, __x__ ) ); }