diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-09-26 13:14:41 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-09-26 13:14:41 -0400 |
commit | 3bec53e0d3bb5e74d2e2dca34f50aadfaf832607 (patch) | |
tree | 0ecc760d1a47571f61869bc43b243b4c4a2fdcab /src/network/ntohs.c | |
parent | 1fa05210100caefc8546746e08358d81739f4b41 (diff) | |
download | musl-3bec53e0d3bb5e74d2e2dca34f50aadfaf832607.tar.gz musl-3bec53e0d3bb5e74d2e2dca34f50aadfaf832607.tar.xz musl-3bec53e0d3bb5e74d2e2dca34f50aadfaf832607.zip |
another cond var fix: requeue count race condition
lock out new waiters during the broadcast. otherwise the wait count added to the mutex might be lower than the actual number of waiters moved, and wakeups may be lost. this issue could also be solved by temporarily setting the mutex waiter count higher than any possible real count, then relying on the kernel to tell us how many waiters were requeued, and updating the counts afterwards. however the logic is more complex, and i don't really trust the kernel. the solution here is also nice in that it replaces some atomic cas loops with simple non-atomic ops under lock.
Diffstat (limited to 'src/network/ntohs.c')
0 files changed, 0 insertions, 0 deletions