Skip to content

[MINIMAL_RUNTIME] Fix ENVIRONMENT_IS_WORKER under WASM_WORKERS + nodejs#26562

Merged
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:fix_wasm_worker_tests
Mar 27, 2026
Merged

[MINIMAL_RUNTIME] Fix ENVIRONMENT_IS_WORKER under WASM_WORKERS + nodejs#26562
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:fix_wasm_worker_tests

Conversation

@sbc100
Copy link
Copy Markdown
Collaborator

@sbc100 sbc100 commented Mar 27, 2026

This fix came about because I was trying to remove the @requires_pthread decorator from the WASM_WORKER tests in test_core.py. This decorator should not be needed or used for wasm worker tests because it injects the -pthread compile flag.

Without this fix the ENVIRONMENT_IS_WORKER is not set correctly under node which means that emscripten_is_main_browser_thread was reporting the wrong value when called from within a Wasm Worker.

This bug was being hidden when the program was compiled with both pthreads and wasm workers enabled.

@sbc100 sbc100 requested a review from kripken March 27, 2026 03:47
@sbc100 sbc100 changed the title Fix ENVIRONMENT_IS_WORKER under WASM_WORKERS + node. NFC Fix ENVIRONMENT_IS_WORKER under WASM_WORKERS + node Mar 27, 2026
@sbc100 sbc100 changed the title Fix ENVIRONMENT_IS_WORKER under WASM_WORKERS + node Fix ENVIRONMENT_IS_WORKER under WASM_WORKERS + node Mar 27, 2026
This fix came about because I was trying to remove the @requied_pthread
decorator from the WASM_WORKER tests in test_core.py

Without this fix the `ENVIRONMENT_IS_WORKER` is not set correctly under
node which means that `emscripten_is_main_browser_thread` was reporting
the wrong value when called from within a Wasm Worker.

This bug was being hidden when the program was compiled with both
pthreads and wasm workers enabled.
@sbc100 sbc100 force-pushed the fix_wasm_worker_tests branch from 4238034 to 419a077 Compare March 27, 2026 03:50
@sbc100 sbc100 requested a review from dschuff March 27, 2026 05:23
@sbc100 sbc100 enabled auto-merge (squash) March 27, 2026 05:23
@sbc100 sbc100 changed the title Fix ENVIRONMENT_IS_WORKER under WASM_WORKERS + node Fix ENVIRONMENT_IS_WORKER under MINIMAL_RUNTIME + WASM_WORKERS + nodejs Mar 27, 2026
@sbc100 sbc100 changed the title Fix ENVIRONMENT_IS_WORKER under MINIMAL_RUNTIME + WASM_WORKERS + nodejs [MINIMAL_RUNTIME] Fix ENVIRONMENT_IS_WORKER under WASM_WORKERS + nodejs Mar 27, 2026
@sbc100 sbc100 merged commit 2b44e64 into emscripten-core:main Mar 27, 2026
38 checks passed
@sbc100 sbc100 deleted the fix_wasm_worker_tests branch March 27, 2026 16:38
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