Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utility thread and further threading support #29

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

Maqrkk
Copy link
Member

@Maqrkk Maqrkk commented Jan 14, 2025

No description provided.

The main browser thread cannot use the atomic wait operation to sleep, so we have to emulate it using busy waiting.
The message queue will be used by the utility thread to listen for incoming messages from other threads.

Message passing via memory was chosen because sending messages through JavaScript is unreliable in some situations.
This commit introduces the utility thread. It is spawned by the main thread, and utilizes a messaging system to receive messages from other threads and do work requested by those threads. For now, this is limited to spawning other workers.
Instead of testing if tid is 1, we now actually test for each Worker whether it is able to use Atomics.wait for a futex wait operation.
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