C auto/C-WW-GR1+WW-R+WW-R
(*
* Result: Sometimes
*
* Process 0 starts (t=197998).
*
* P0 advances one grace period (t=297998).
*
* P1 goes back a bit less than one grace period (t=198999).
*
* P2 goes back a bit less than one grace period (t=100000).
*
* Process 0 start at t=197998, process 3 end at t=100000: Cycle allowed.
*)
{
}
P0(int *x0, int *x1)
{
rcu_read_lock();
WRITE_ONCE(*x0, 2);
rcu_read_unlock();
synchronize_rcu();
WRITE_ONCE(*x1, 1);
}
P1(int *x1, int *x2)
{
rcu_read_lock();
WRITE_ONCE(*x1, 2);
WRITE_ONCE(*x2, 1);
rcu_read_unlock();
}
P2(int *x2, int *x0)
{
rcu_read_lock();
WRITE_ONCE(*x2, 2);
WRITE_ONCE(*x0, 1);
rcu_read_unlock();
}
Observed
x2=2; x1=2; x0=2;