Skip to content

Remove PThread.runningWorkers. NFC#26998

Open
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:remove-running-workers
Open

Remove PThread.runningWorkers. NFC#26998
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:remove-running-workers

Conversation

@sbc100
Copy link
Copy Markdown
Collaborator

@sbc100 sbc100 commented May 22, 2026

Remove PThread.runningWorkers and use PThread.pthreads instead to track running workers. PThread.pthreads already contains all the necessary information, and keeping both in sync was redundant.

This also optimizes thread exit by replacing an O(N) array splice with an O(1) map deletion, at the cost of making count queries (mostly used in tests) O(N) instead of O(1).

Remove `PThread.runningWorkers` and use `PThread.pthreads` instead to
track running workers. `PThread.pthreads` already contains all the
necessary information, and keeping both in sync was redundant.

This also optimizes thread exit by replacing an O(N) array splice with
an O(1) map deletion, at the cost of making count queries (mostly used
in tests) O(N) instead of O(1).

TAG=agy
CONV=47f918e2-bd47-4e38-9a6d-af1765cf2f7e
@sbc100 sbc100 changed the title refactor(pthread): remove PThread.runningWorkers Remove PThread.runningWorkers. NFC May 22, 2026
@sbc100 sbc100 requested review from dschuff and kripken May 22, 2026 23:26
@sbc100 sbc100 enabled auto-merge (squash) May 23, 2026 00:19
@sbc100 sbc100 requested a review from kleisauke May 23, 2026 17:04
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.

1 participant