Peterson's Algorithm on Producer/Single Consumer Question
I'm trying to make some code I've written run faster. I have a single produer and single consumer at the moment. I am using semafores and mutexes to control the critical sections. I have been reading and this does take quite a bit of overhead.
I stumbled across this from wikipedia, https://en.wikipedia.org/wiki/Peterson%27s_algorithm.
Has anyone used it before? I read some conflicting things like C99 can't implement a full peterson lock. Once I get a better idea I'll post some code.
Do the while loops have any sort of Sleep or Delay? Or do they run as fast as they can for a short duration.