Back to home page

OSCL-LXR

 
 

    


0001 C Atomic-RMW-ops-are-atomic-WRT-atomic_set
0002 
0003 (*
0004  * Result: Never
0005  *
0006  * Test that atomic_set() cannot break the atomicity of atomic RMWs.
0007  * NOTE: This requires herd7 7.56 or later which supports "(void)expr".
0008  *)
0009 
0010 {
0011         atomic_t v = ATOMIC_INIT(1);
0012 }
0013 
0014 P0(atomic_t *v)
0015 {
0016         (void)atomic_add_unless(v, 1, 0);
0017 }
0018 
0019 P1(atomic_t *v)
0020 {
0021         atomic_set(v, 0);
0022 }
0023 
0024 exists
0025 (v=2)