Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on A flexible, lightweight, spin-lock barrier. Parent comment
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
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: