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: Allow implementations to pad timeouts in SuspendAgent #2973

Merged
merged 1 commit into from
Jan 5, 2023
Merged
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
10 changes: 8 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -42214,7 +42214,7 @@ <h1>
SuspendAgent (
_WL_: a WaiterList,
_W_: an agent signifier,
_timeout_: a non-negative integer,
_minimumTimeout_: a non-negative extended mathematical value,
): a Boolean
</h1>
<dl class="header">
Expand All @@ -42224,11 +42224,17 @@ <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. Let _additionalTimeout_ be an implementation-defined non-negative mathematical value.
1. Let _timeout_ be _minimumTimeout_ + _additionalTimeout_.
1. NOTE: When _minimumTimeout_ is +∞, _timeout_ is also +∞ and the following step can terminate only by another agent calling NotifyWaiter.
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 wake from suspension 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 EnterCriticalSection(_WL_).
1. If _W_ was notified explicitly by another agent calling NotifyWaiter with arguments _WL_ and _W_, return *true*.
1. Return *false*.
</emu-alg>
<emu-note>
<p>_additionalTimeout_ allows implementations to pad timeouts as necessary, such as for reducing power consumption or coarsening timer resolution to mitigate timing attacks. This value may differ from call to call of SuspendAgent.</p>
</emu-note>
</emu-clause>

<emu-clause id="sec-notifywaiter" type="abstract operation">
Expand Down