summaryrefslogtreecommitdiff
path: root/Documentation/litmus-tests/atomic/Atomic-RMW-ops-are-atomic-WRT-atomic_set.litmus
blob: 49385314d911bd7442a2dfc4bbfbb4aff31a6992 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
C Atomic-RMW-ops-are-atomic-WRT-atomic_set

(*
 * Result: Never
 *
 * Test that atomic_set() cannot break the atomicity of atomic RMWs.
 *)

{
	atomic_t v = ATOMIC_INIT(1);
}

P0(atomic_t *v)
{
	(void)atomic_add_unless(v, 1, 0);
}

P1(atomic_t *v)
{
	atomic_set(v, 0);
}

exists
(v=2)