Fix keepRuntimeAlive for pthreads#22927
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.
| // 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.
Maybe I was just wanting to be emphatic! :)
There was a problem hiding this comment.
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.
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.
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.
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