summaryrefslogtreecommitdiff
path: root/src/stdio/ftrylockfile.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-06-29 02:24:02 -0400
committerRich Felker <dalias@aerifal.cx>2013-06-29 02:24:02 -0400
commit509b50eda8ea7d4a28f738e4cf8ea98d25959f00 (patch)
tree1f042d8cb5c8cc228dc55e54f36d26a94fcac442 /src/stdio/ftrylockfile.c
parent17aef0b41e3d7cb37c476cbe2df26fc444518a64 (diff)
downloadmusl-509b50eda8ea7d4a28f738e4cf8ea98d25959f00.tar.gz
fix missing synchronization in calls from dynamic linker to global ctors
this change is needed to correctly handle the case where a constructor creates a new thread which calls dlopen. previously, the lock was not held in this case. the reason for the complex logic to avoid locking whenever possible is that, since the mutex is recursive, it will need to inspect the thread pointer to get the current thread's tid, and this requires initializing the thread pointer. we do not want non-multi-threaded programs to attempt to access the thread pointer unnecessarily; doing so could make them crash on ancient kernels that don't support threads but which may otherwise be capable of running the program.
Diffstat (limited to 'src/stdio/ftrylockfile.c')
0 files changed, 0 insertions, 0 deletions