linux/Documentation/litmus-tests/atomic/Atomic-RMW-ops-are-atomic-WRT-atomic_set.litmus
<<
>>
Prefs
   1C 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
  14P0(atomic_t *v)
  15{
  16        (void)atomic_add_unless(v, 1, 0);
  17}
  18
  19P1(atomic_t *v)
  20{
  21        atomic_set(v, 0);
  22}
  23
  24exists
  25(v=2)
  26