MP+polocks.litmus 317 B

123456789101112131415161718192021222324
  1. C MP+polocks
  2. {}
  3. P0(int *x, int *y, spinlock_t *mylock)
  4. {
  5. WRITE_ONCE(*x, 1);
  6. spin_lock(mylock);
  7. WRITE_ONCE(*y, 1);
  8. spin_unlock(mylock);
  9. }
  10. P1(int *x, int *y, spinlock_t *mylock)
  11. {
  12. int r0;
  13. int r1;
  14. spin_lock(mylock);
  15. r0 = READ_ONCE(*y);
  16. spin_unlock(mylock);
  17. r1 = READ_ONCE(*x);
  18. }
  19. exists (1:r0=1 /\ 1:r1=0)