1 C Atomic-RMW-ops-are-atomic-WRT-atomic_set 1 C Atomic-RMW-ops-are-atomic-WRT-atomic_set 2 2 3 (* 3 (* 4 * Result: Never 4 * Result: Never 5 * 5 * 6 * Test that atomic_set() cannot break the ato 6 * Test that atomic_set() cannot break the atomicity of atomic RMWs. 7 * NOTE: This requires herd7 7.56 or later whi 7 * NOTE: This requires herd7 7.56 or later which supports "(void)expr". 8 *) 8 *) 9 9 10 { 10 { 11 atomic_t v = ATOMIC_INIT(1); 11 atomic_t v = ATOMIC_INIT(1); 12 } 12 } 13 13 14 P0(atomic_t *v) 14 P0(atomic_t *v) 15 { 15 { 16 (void)atomic_add_unless(v, 1, 0); 16 (void)atomic_add_unless(v, 1, 0); 17 } 17 } 18 18 19 P1(atomic_t *v) 19 P1(atomic_t *v) 20 { 20 { 21 atomic_set(v, 0); 21 atomic_set(v, 0); 22 } 22 } 23 23 24 exists 24 exists 25 (v=2) 25 (v=2)
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.