News for hackers. Stuff that matters.
Re:A flexible, lightweight, spin-lock barrier by gpderetta on Tuesday March 15, 2022 @03:13PM (#30689848)
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
Re:A flexible, lightweight, spin-lock barrier by atq2119 on Tuesday March 15, 2022 @04:36PM (#30691264)
Your spin loop could easily miss the time during which *b == 0. The article explains that. A separate phase bit is required.
Re:A flexible, lightweight, spin-lock barrier by gpderetta on Tuesday March 15, 2022 @04:43PM (#30691384)
Yes. I see it now.