diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-08-18 01:26:16 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-08-18 01:26:16 -0400 |
commit | 2c4b510bae1b2841e6983a5639dd600255898442 (patch) | |
tree | 90937b95d648d6a63f96896747a4bcaadab03616 /src/temp | |
parent | 37195db8ec31300a87bc7ec09d2adcf299e9203d (diff) | |
download | musl-2c4b510bae1b2841e6983a5639dd600255898442.tar.gz musl-2c4b510bae1b2841e6983a5639dd600255898442.tar.xz musl-2c4b510bae1b2841e6983a5639dd600255898442.zip |
simplify and improve new cond var implementation
previously, wake order could be unpredictable: if a waiter happened to leave its futex wait on the state early, e.g. due to EAGAIN while restarting after a signal handler, it could acquire the mutex out of turn. handling this required ugly O(n) list walking in the unwait function and accounting to remove waiters that already woke from the list. with the new changes, the "barrier" locks in each waiter node are only unlocked in turn. in addition to simplifying the code, this seems to improve performance slightly, probably by reducing the number of accesses threads make to each other's stacks. as an additional benefit, unrecoverable mutex re-locking errors (mainly ENOTRECOVERABLE for robust mutexes) no longer need to be handled with deadlock; they can be reported to the caller, since the unlocking sequence makes it unnecessary to rely on the mutex to synchronize access to the waiter list.
Diffstat (limited to 'src/temp')
0 files changed, 0 insertions, 0 deletions