Use native code for pthread_cleanup_push/pop. NFC - #14484
Merged
Conversation
sbc100
force-pushed
the
pthread_cleanup_push_pop
branch
2 times, most recently
from
June 18, 2021 16:56
3ee3c7a to
294a9e2
Compare
Collaborator
Author
|
I'm pretty happy with how this change turned out! |
sbc100
force-pushed
the
pthread_cleanup_push_pop
branch
from
June 18, 2021 17:47
294a9e2 to
6360f7c
Compare
sbc100
force-pushed
the
pthread_cleanup_push_pop
branch
from
June 18, 2021 20:37
6360f7c to
845a01c
Compare
sbc100
force-pushed
the
pthread_cleanup_push_pop
branch
from
June 18, 2021 21:18
845a01c to
3c466d6
Compare
sbc100
enabled auto-merge (squash)
June 18, 2021 21:20
sbc100
force-pushed
the
pthread_cleanup_push_pop
branch
from
June 18, 2021 22:16
3c466d6 to
22683fc
Compare
This change reverts one of our musl patches so that `pthread_cleanup_push/pop` are now implemented as macros as in upstream musl. `pthread_cleanup_push/pop` are now handled separately to `__cxa_atexit_thread`, which is technically a bug fix. Without this fix, calling `__cxa_atexit_thread` in the middle of push/pop block would end up pop'ing the wrong thing at the end. Overall this reduces the API surface of our JS API and increases the amount of code we share with musl, while also reducing the cost of `pthread_cleanup_push/pop.` Now, they never involve any allocation or calls to JS!
sbc100
force-pushed
the
pthread_cleanup_push_pop
branch
from
June 18, 2021 23:17
22683fc to
c2e0862
Compare
kleisauke
reviewed
Jun 23, 2021
| self->cancelbuf = cb; | ||
| static thread_local bool registerd = false; | ||
| if (!registerd) { | ||
| __cxa_thread_atexit(__run_cleanup_handlers, NULL, &__dso_handle); |
Collaborator
There was a problem hiding this comment.
Should we set registerd (typo: registered) to true here? Noticed this during the review of #14489.
sbc100
added a commit
that referenced
this pull request
Jun 23, 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 change reverts one of our musl patches so that
pthread_cleanup_push/popare now implemented as macros as in upstreammusl.
pthread_cleanup_push/popare now handled separately to__cxa_atexit_thread, which is technically a bug fix. Without this fix,calling
__cxa_atexit_threadin the middle of push/pop block would end uppop'ing the wrong thing at the end.
Overall this reduces the API surface of our JS API and increases the
amount of code we share with musl, while also reducing the cost of
pthread_cleanup_push/pop.Now, they never involve any allocation orcalls to JS!