-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix keepRuntimeAlive for pthreads #22927
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
e29b598 to
a069cf0
Compare
a069cf0 to
691d428
Compare
src/library.js
Outdated
| #if PTHREADS | ||
| $keepRuntimeAlive: () => !ENVIRONMENT_IS_PTHREAD, | ||
| #else | ||
| // However, for pthreads we always always need to allow the runtime to exit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // However, for pthreads we always always need to allow the runtime to exit | |
| // However, for pthreads we always need to allow the runtime to exit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I was just wanting to be emphatic! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, these double-positives/double-negatives always remind me of the joke,
A teacher told the class, "English has double negatives
that cancel out: 'I don't not want to go' means I want
to go, at least somewhat. But a double positive, unlike
in other languages, is basically the same as a positive."
A student at the back of the class scoffed, "Yeah, right."
src/library.js
Outdated
| #if PTHREADS | ||
| $keepRuntimeAlive: () => !ENVIRONMENT_IS_PTHREAD, | ||
| #else | ||
| // However, for pthreads we always always need to allow the runtime to exit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to always allow the runtime to exit with pthreads? Is that documented somewhere?
And, if so, should we do pthreads => EXIT_RUNTIME=1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because pthreads themselves need to be able to exit. EXIT_RUNTIME=0 means the main thread never exits but it doesn't mean that pthreads can't exit.
Each pthread has its own "runtime" that can be kept alive and stops the thread from exiting. EXIT_RUNTIME has not effect (or should have no effect) on threads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the comment.
691d428 to
635f94f
Compare
Still need to figure out how to test this. Fixes: emscripten-core#22889
635f94f to
41f4194
Compare
Fixes: #22889