Skip to content

Conversation

@juj
Copy link
Collaborator

@juj juj commented Nov 22, 2025

When Atomics.wait() is polyfilled, do not attempt to use it in _emscripten_thread_mailbox_await(), since the polyfill will not work there. This is take two at fixing #25494.

juj added 2 commits November 22, 2025 14:06
…ipten_thread_mailbox_await(), since the polyfill will not work there. This is take two at fixing emscripten-core#25494.
_emscripten_thread_mailbox_await__deps: ['$checkMailbox', '$waitAsyncPolyfilled'],
_emscripten_thread_mailbox_await: (pthread_ptr) => {
if (Atomics.waitAsync) {
if (!Atomics.waitAsyncPolyfilled) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not just if (waitAsyncPolyfilled)? i.e. why modify the Atomics object at all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The idea was to make it look like a public API, if other code might need to check if the implementation was polyfilled or not. Changed to not modify the Atomics object.

@juj juj force-pushed the mailbox_await_use_postmessage branch from 9df5170 to ab34b32 Compare November 22, 2025 21:30
@sbc100
Copy link
Collaborator

sbc100 commented Nov 22, 2025

I assume there reason there is no test here is because writing a tests very hard?

@juj
Copy link
Collaborator Author

juj commented Nov 26, 2025

I assume there reason there is no test here is because writing a tests very hard?

There is an existing test that is flaky due to this - browser.test_pthread_main_thread_blocking_join, so there is some amount of coverage at least.

@juj juj merged commit e1a0f02 into emscripten-core:main Nov 26, 2025
33 of 34 checks passed
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.

2 participants