refactor: remove use of PThread.runningWorkers#216
Open
toyobayashi wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Removes the now-redundant PThread.runningWorkers array (deprecated upstream in emscripten-core/emscripten#26998) and derives running workers from PThread.pthreads instead. Also tightens the cleanup guard in WASIThreads spawn error handling.
Changes:
- Delete
runningWorkersfield fromThreadManagerand all push/splice maintenance sites. - Replace
runningWorkers.forEachusages withObject.values(PThread.pthreads).forEachin TSFN, async-work, and the associated@__postsetcomment. - Consolidate
cleanThreadcalls inWASIThreadsspawn into a singlecatchblock guarded byworker !== undefined && tid !== undefined.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/wasi-threads/src/thread-manager.ts | Remove runningWorkers field/maintenance; iterate pthreads in terminateAllThreads. |
| packages/wasi-threads/src/wasi-threads.ts | Make tid optional and move cleanup into the catch block with guards. |
| packages/emnapi/src/threadsafe-function.ts | Replace runningWorkers.forEach with Object.values(PThread.pthreads).forEach. |
| packages/emnapi/src/core/async-work.ts | Same replacement for the async-work listener setup. |
| packages/emnapi/src/emscripten/async.ts | Update @__postset doc comment to reflect the new iteration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
emscripten-core/emscripten#26998