Skip to content

Proposal: Allow Atomics.wait on the main thread #12570

@tlively

Description

@tlively

What problem are you trying to solve?

When developers bring multithreaded libraries and applications to the Web, they are forced to use inefficient spinlocks because Atomics.wait currently throws an exception on the main browser thread. I am proposing that we improve application performance and energy usage for end users by changing the platform to allow Atomics.wait (and its WebAssembly equivalents) on the main thread.

What solutions exist today?

Please see the explainer for a full explanation of the problem, what developers do today, and various possible solutions. There is also existing discussion and developer feedback at WebAssembly/shared-everything-threads#112.

How would you solve it?

The simplest fix would be to update the HTML spec to set canBlock to true instead of false when creating similar-origin window agents.

Anything else?

I know this proposal blatantly violates the "do not block the main thread" design principle, but this is a special case and the status quo is worse, so please give the explainer a read!

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interest

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions