3 ms·
So, I understand that the difficulty is being able to reset the barrier without a quiescent period. It seems to me that a counter being able to count to n is e
by gpderetta 5y ago
So, I understand that the difficulty is being able to reset the barrier without a quiescent period.
It seems to me that a counter being able to count to n is enough and there is no need of an explicit phase bit:
Wait(int *b, int n):
1: x = *b
if (x == n-1)
*b=0 //last, reset
else if cas(b, x, x+1)
2: if *b goto 2
else goto 1