On Tue, 2 Mar 2021 at 21:04, Paul E. McKenney <paulmck@xxxxxxxxxx> wrote: > [...] > > And if the answer is "yes", how about this one? > With the == to != change in P1, this is OK! > P0(int *prod, int *cons, int *data) > { > int p; > > p = READ_ONCE(*prod); > if (p == READ_ONCE(*cons)) { ...and now d==1 is not a valid state anymore according to herd. If think I need some input here! :-D > WRITE_ONCE(*data, 1); > smp_wmb(); > WRITE_ONCE(*prod, p ^ 1); > } > } > > P1(int *prod, int *cons, int *data) > { > int c; > int d = -1; > > c = READ_ONCE(*cons); > if (READ_ONCE(*prod) == c) { > smp_rmb(); > d = READ_ONCE(*data); > smp_mb(); > WRITE_ONCE(*cons, c ^ 1); > } > } > [...] Björn