14dcd4d36SBoqun FengC Atomic-RMW-ops-are-atomic-WRT-atomic_set 24dcd4d36SBoqun Feng 34dcd4d36SBoqun Feng(* 44dcd4d36SBoqun Feng * Result: Never 54dcd4d36SBoqun Feng * 64dcd4d36SBoqun Feng * Test that atomic_set() cannot break the atomicity of atomic RMWs. 75ef0a07aSAkira Yokosawa * NOTE: This requires herd7 7.56 or later which supports "(void)expr". 84dcd4d36SBoqun Feng *) 94dcd4d36SBoqun Feng 104dcd4d36SBoqun Feng{ 114dcd4d36SBoqun Feng atomic_t v = ATOMIC_INIT(1); 124dcd4d36SBoqun Feng} 134dcd4d36SBoqun Feng 144dcd4d36SBoqun FengP0(atomic_t *v) 154dcd4d36SBoqun Feng{ 164dcd4d36SBoqun Feng (void)atomic_add_unless(v, 1, 0); 174dcd4d36SBoqun Feng} 184dcd4d36SBoqun Feng 194dcd4d36SBoqun FengP1(atomic_t *v) 204dcd4d36SBoqun Feng{ 214dcd4d36SBoqun Feng atomic_set(v, 0); 224dcd4d36SBoqun Feng} 234dcd4d36SBoqun Feng 244dcd4d36SBoqun Fengexists 254dcd4d36SBoqun Feng(v=2) 26