Repository navigation
Refactor stub version of pthread key handling to avoid allocation. NFC - #15087
Merged
Merged
Conversation
sbc100
commented
Sep 22, 2021
This is needed by a followup PR (#15086) which improves our LSan support. LSan wants to be able to call pthread_key_create during its own startup and doesn't expect allocation to occur during this time: https://github.com/emscripten-core/emscripten/blob/6b53dedf3d2ace15bfd780e44f4a8ba34407fc27/system/lib/compiler-rt/lib/lsan/lsan.cpp#L113 This method of using a static array of keys is also the one used by musl so this seems like a reasonable implementation: https://github.com/emscripten-core/emscripten/blob/6b53dedf3d2ace15bfd780e44f4a8ba34407fc27/system/lib/libc/musl/src/thread/pthread_key_create.c#L8
sbc100
force-pushed
the
stub_tls_refactor
branch
from
September 22, 2021 00:53
0f8f650 to
939427a
Compare
Collaborator
|
Hah, I seem to remember I wrote some of this horrible code because last time we determined we needed to have a variable maximum, is that not needed anymore? |
Collaborator
Author
I have some memory of that too.. but based on the fact that all the tests pass... and musl has that limit internally.. this seems reasonable. |
aardappel
approved these changes
Sep 22, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is needed by a followup PR (#15086) which improves our LSan
support. LSan wants to be able to call pthread_key_create during its
own startup and doesn't expect allocation to occur during this time:
emscripten/system/lib/compiler-rt/lib/lsan/lsan.cpp
Line 113 in 6b53ded
This method of using a static array of keys is also the one used
by musl so this seems like a reasonable implementation:
emscripten/system/lib/libc/musl/src/thread/pthread_key_create.c
Line 8 in 6b53ded