Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Nov 14, 2024

Fixes: #22889

src/library.js Outdated
#if PTHREADS
$keepRuntimeAlive: () => !ENVIRONMENT_IS_PTHREAD,
#else
// However, for pthreads we always always need to allow the runtime to exit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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.

Copy link
Collaborator Author

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! :)

Copy link
Member

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
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the comment.

Still need to figure out how to test this.

Fixes: emscripten-core#22889
@sbc100 sbc100 requested a review from kripken November 14, 2024 23:03
@sbc100 sbc100 enabled auto-merge (squash) November 14, 2024 23:03
@sbc100 sbc100 merged commit 82a8f2d into emscripten-core:main Nov 14, 2024
28 checks passed
@sbc100 sbc100 deleted the keepRuntimeAlive branch November 14, 2024 23:18
uysalibov pushed a commit to uysalibov/emscripten that referenced this pull request Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot read properties of undefined (reading 'getParameter') since 3.1.70 (WebGL)

2 participants