Skip to content

Simplify pthread ref/unref handling. NFC#26939

Merged
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:unref
May 13, 2026
Merged

Simplify pthread ref/unref handling. NFC#26939
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:unref

Conversation

@sbc100
Copy link
Copy Markdown
Collaborator

@sbc100 sbc100 commented May 13, 2026

We don't need/want threads to be unref until the worker is up and
running. This is important for #26933 since otherwise the node runtime
can shut down while a thread is starting up.

This change also simplifies the code by limiting the number of places we called unref to just one, which also slightly reduces codesize.

Also, remove unused worker.loaded assignment.

Split out from #26933

Comment thread src/lib/libpthread.js
We don't need/want threads to be `unref` until the worker is up and
running.   This is important for emscripten-core#26933 since otherwise the node runtime
can shut down while a thread is starting up.

This change also simplifies the code by limiting the number of places we
called `unref` to just one, which also slightly reduces codesize.

Also, remove unused `worker.loaded` assignment.

Split out from emscripten-core#26933
@sbc100 sbc100 enabled auto-merge (squash) May 13, 2026 19:11
@sbc100 sbc100 requested review from RReverser and tlively May 13, 2026 19:16
@sbc100 sbc100 merged commit d33d7b1 into emscripten-core:main May 13, 2026
30 checks passed
@sbc100 sbc100 deleted the unref branch May 13, 2026 22:47
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