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

Normative: Treat the Atomics.wait timeout as an extended mathematical lower bound #2965

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -41981,7 +41981,7 @@ <h1>
SuspendAgent (
_WL_: a WaiterList,
_W_: an agent signifier,
_timeout_: a non-negative integer,
_timeout_: a non-negative extended mathematical value,
): a Boolean
</h1>
<dl class="header">
Expand All @@ -41991,7 +41991,7 @@ <h1>
1. Assert: _W_ is equivalent to AgentSignifier().
1. Assert: _W_ is on the list of waiters in _WL_.
1. Assert: AgentCanSuspend() is *true*.
1. Perform LeaveCriticalSection(_WL_) and suspend _W_ for up to _timeout_ milliseconds, performing the combined operation in such a way that a notification that arrives after the critical section is exited but before the suspension takes effect is not lost. _W_ can notify either because the timeout expired or because it was notified explicitly by another agent calling NotifyWaiter with arguments _WL_ and _W_, and not for any other reasons at all.
1. Perform LeaveCriticalSection(_WL_) and suspend _W_ until either _W_ is notified by another agent calling NotifyWaiter with arguments _WL_ and _W_ or at least _timeout_ milliseconds have elapsed, performing the combined operation in such a way that a notification arriving after the critical section is exited but before the suspension takes effect is not lost.
1. Perform EnterCriticalSection(_WL_).
1. If _W_ was notified explicitly by another agent calling NotifyWaiter with arguments _WL_ and _W_, return *true*.
1. Return *false*.
Expand Down Expand Up @@ -42282,9 +42282,14 @@ <h1>Atomics.wait ( _typedArray_, _index_, _value_, _timeout_ )</h1>
1. Else,
1. Perform RemoveWaiter(_WL_, _W_).
1. Perform LeaveCriticalSection(_WL_).
1. Let _padding_ be an implementation-defined non-negative mathematical value.
1. [id="step-atomics.wait-degrade-resolution"] If _padding_ ≠ 0, wait until a further _padding_ milliseconds have elapsed.
1. If _notified_ is *true*, return *"ok"*.
1. Return *"timed-out"*.
</emu-alg>
<emu-note>
<p>Step <emu-xref href="#step-atomics.wait-degrade-resolution"></emu-xref> allows implementations to pad timeouts, which they might use to mitigate timing attacks and/or support processor timers with coarse resolution.</p>
</emu-note>
</emu-clause>

<emu-clause id="sec-atomics.notify">
Expand Down