diff options
author | Rich Felker <dalias@aerifal.cx> | 2019-09-06 16:17:44 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2019-09-06 16:17:44 -0400 |
commit | 8a544ee3a2a75af278145b09531177cab4939b41 (patch) | |
tree | 19d8be4deb3afc672e7e7b56befe387b80d021b8 /src/thread/x86_64/syscall_cp.s | |
parent | 022f27d541af68f047d367ad9d93f941135555c1 (diff) | |
download | musl-8a544ee3a2a75af278145b09531177cab4939b41.tar.gz musl-8a544ee3a2a75af278145b09531177cab4939b41.tar.xz musl-8a544ee3a2a75af278145b09531177cab4939b41.zip |
synchronously clean up pthread_create failure due to scheduling errors
previously, when pthread_create failed due to inability to set explicit scheduling according to the requested attributes, the nascent thread was detached and made responsible for its own cleanup via the standard pthread_exit code path. this left it consuming resources potentially well after pthread_create returned, in a way that the application could not see or mitigate, and unnecessarily exposed its existence to the rest of the implementation via the global thread list. instead, attempt explicit scheduling early and reuse the failure path for __clone failure if it fails. the nascent thread's exit futex is not needed for unlocking the thread list, since the thread calling pthread_create holds the thread list lock the whole time, so it can be repurposed to ensure the thread has finished exiting. no pthread_exit is needed, and freeing the stack, if needed, can happen just as it would if __clone failed.
Diffstat (limited to 'src/thread/x86_64/syscall_cp.s')
0 files changed, 0 insertions, 0 deletions