summaryrefslogtreecommitdiff
path: root/src/thread/pthread_mutexattr_setrobust.c
AgeCommit message (Collapse)AuthorLines
2014-08-16enable private futex for process-local robust mutexesRich Felker-0/+22
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.
2013-07-22make pthread attribute types structs, even when they just have one fieldRich Felker-2/+2
this change is to get the right tags for C++ ABI matching. it should have no other effects.
2011-03-17implement robust mutexesRich Felker-0/+9
some of this code should be cleaned up, e.g. using macros for some of the bit flags, masks, etc. nonetheless, the code is believed to be working and correct at this point.