diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-08-16 02:28:34 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-08-16 02:28:34 -0400 |
commit | b092f1c5fa9c048e12d002c7b972df5ecbe96d1d (patch) | |
tree | 0df198584bdcffa4d7c2242d98fde57658bd4a1e /src/thread/pthread_mutex_timedlock.c | |
parent | bc09d58c0432a4eca5f6a1e536679a527f971116 (diff) | |
download | musl-b092f1c5fa9c048e12d002c7b972df5ecbe96d1d.tar.gz musl-b092f1c5fa9c048e12d002c7b972df5ecbe96d1d.tar.bz2 musl-b092f1c5fa9c048e12d002c7b972df5ecbe96d1d.tar.xz musl-b092f1c5fa9c048e12d002c7b972df5ecbe96d1d.zip |
enable private futex for process-local robust mutexes
the kernel always uses non-private wake when walking the robust list
when a thread or process exits, so it's not able to wake waiters
listening with the private futex flag. this problem is solved by doing
the equivalent in userspace as the last step of pthread_exit.
care is taken to remove mutexes from the robust list before unlocking
them so that the kernel will not attempt to access them again,
possibly after another thread locks them. this removal code can treat
the list as singly-linked, since no further code which would add or
remove items is able to run at this point. moreover, the pending
pointer is not needed since the mutexes being unlocked are all
process-local; in the case of asynchronous process termination, they
all cease to exist.
since a process-local robust mutex cannot come into existence without
a call to pthread_mutexattr_setrobust in the same process, the code
for userspace robust list processing is put in that source file, and
a weak alias to a dummy function is used to avoid pulling in this
bloat as part of pthread_exit in static-linked programs.
Diffstat (limited to 'src/thread/pthread_mutex_timedlock.c')
0 files changed, 0 insertions, 0 deletions