Test cmpxchg-01

C cmpxchg-01



{ atomic_t v; atomic_t w;}

P0(atomic_t *v, atomic_t *w) {
  int r1 ;
  atomic_set(v,1) ;
  r1 = atomic_cmpxchg(w, 1, 2);
}

P1(atomic_t *v, atomic_t *w) {
  int r1 ;
  atomic_set(w,1) ;
  r1 = atomic_cmpxchg(v, 1, 2);
}


Observed
    w=1; v=1; 1:r1=0; 0:r1=0;