Atomic-RMW-ops-are-atomic-WRT-atomic_set.litmus 357 B

12345678910111213141516171819202122232425
  1. C Atomic-RMW-ops-are-atomic-WRT-atomic_set
  2. (*
  3. * Result: Never
  4. *
  5. * Test that atomic_set() cannot break the atomicity of atomic RMWs.
  6. * NOTE: This requires herd7 7.56 or later which supports "(void)expr".
  7. *)
  8. {
  9. atomic_t v = ATOMIC_INIT(1);
  10. }
  11. P0(atomic_t *v)
  12. {
  13. (void)atomic_add_unless(v, 1, 0);
  14. }
  15. P1(atomic_t *v)
  16. {
  17. atomic_set(v, 0);
  18. }
  19. exists
  20. (v=2)