-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Handle exit() from pthread by posting exitProcess back to main thread #12933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d547c58
to
ff943b3
Compare
18fd850
to
37b298a
Compare
ff943b3
to
68fb6e5
Compare
Its not clear to me how this should interact with I'm not sure how to interpret the comment on this line: Line 439 in bd9b271
// EXIT_RUNTIME=0 only applies to default behavior of the main browser thread
But the net effect of that line is that |
68fb6e5
to
bfd5c07
Compare
bfd5c07
to
2171282
Compare
2171282
to
97602fb
Compare
Needed for #12928 |
I think when |
97602fb
to
198e39b
Compare
I think the reason why we don't honor the EXIT_RUNTIME setting by default in pthread code is because it is on by default and it would break almost all pthread code if threads were not joinable once they returned from their entry point. Code can still opt out by explictly setting This change means that exit() always honors EXIT_RUNTIME, even when called from threads. Because we post the exit request back to the main thread it allows the main thread to make the decision. |
198e39b
to
a7767ba
Compare
Hmm, it's off by default, isn't it, not on - maybe a typo? And I'm not sure why it would break code. How does joinability relate to EXIT_RUNTIME? |
Because if you do I think this is why, we don't set If we did set Unlike the main thread there is often somebody waiting for a thread to exit. |
This change does change the existing behaviour or the existing setup of All this change does is proxy the C exit() calls back to the main thread so it can decide how to handle it. |
a7767ba
to
168ccf5
Compare
That is the second time I've seen it fail, and last time the next build was fine (still waiting on the next one this time). |
We have pthread_exit() for users who only want to exit from the one thread (this
is the same as returning from the thread entry point).
The C exit function on the other hand is supposed to bring down the whole process.