R+poonceonces.litmus 388 B

123456789101112131415161718192021222324252627
  1. C R+poonceonces
  2. (*
  3. * Result: Sometimes
  4. *
  5. * This is the unordered (thus lacking smp_mb()) version of one of the
  6. * classic counterintuitive litmus tests that illustrates the effects of
  7. * store propagation delays.
  8. *)
  9. {}
  10. P0(int *x, int *y)
  11. {
  12. WRITE_ONCE(*x, 1);
  13. WRITE_ONCE(*y, 1);
  14. }
  15. P1(int *x, int *y)
  16. {
  17. int r0;
  18. WRITE_ONCE(*y, 2);
  19. r0 = READ_ONCE(*x);
  20. }
  21. exists (y=2 /\ 1:r0=0)