diff options
author | Vinson Lee <[email protected]> | 2010-04-26 00:25:30 -0700 |
---|---|---|
committer | Vinson Lee <[email protected]> | 2010-04-26 00:31:20 -0700 |
commit | 31db310be489e1fc83fa3f72366e2e5fdd2a00e7 (patch) | |
tree | 341a6a27e0fe59f81397a2256abbea4f8af58fb8 /progs/trivial/poly.c | |
parent | 59fcbc0ac5458c14ae2ec783df8736f3e2fe0963 (diff) |
os: Check for spurious wakeups in pipe_barrier_wait.
The POSIX function pthread_cond_wait can have spurious wakeups when
waiting on a condition variable.
Add a 64-bit counter that is incremented whenever the barrier becomes
full. A woken thread checks the counter. If the counter has not changed
then it has been spuriously woken and goes back to sleep. If the counter
has changed then it was properly signaled and exits the barrier.
Tested on Mac OS X.
This patch was based on ideas from Luca Barbieri.
Diffstat (limited to 'progs/trivial/poly.c')
0 files changed, 0 insertions, 0 deletions