GNU Linux-libre 6.1.90-gnu
[releases.git] / Documentation / litmus-tests / atomic / Atomic-RMW-ops-are-atomic-WRT-atomic_set.litmus
1 C Atomic-RMW-ops-are-atomic-WRT-atomic_set
2
3 (*
4  * Result: Never
5  *
6  * Test that atomic_set() cannot break the atomicity of atomic RMWs.
7  * NOTE: This requires herd7 7.56 or later which supports "(void)expr".
8  *)
9
10 {
11         atomic_t v = ATOMIC_INIT(1);
12 }
13
14 P0(atomic_t *v)
15 {
16         (void)atomic_add_unless(v, 1, 0);
17 }
18
19 P1(atomic_t *v)
20 {
21         atomic_set(v, 0);
22 }
23
24 exists
25 (v=2)