Skip to content

Commit 89ef660

Browse files
sygljharb
authored andcommitted
Normative: Allow implementations to pad timeouts in SuspendAgent (#2973)
Closes #2914.
1 parent 21ffeee commit 89ef660

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

spec.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -42214,7 +42214,7 @@ <h1>
4221442214
SuspendAgent (
4221542215
_WL_: a WaiterList,
4221642216
_W_: an agent signifier,
42217-
_timeout_: a non-negative integer,
42217+
_minimumTimeout_: a non-negative extended mathematical value,
4221842218
): a Boolean
4221942219
</h1>
4222042220
<dl class="header">
@@ -42224,11 +42224,17 @@ <h1>
4222442224
1. Assert: _W_ is equivalent to AgentSignifier().
4222542225
1. Assert: _W_ is on the list of waiters in _WL_.
4222642226
1. Assert: AgentCanSuspend() is *true*.
42227-
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.
42227+
1. Let _additionalTimeout_ be an implementation-defined non-negative mathematical value.
42228+
1. Let _timeout_ be _minimumTimeout_ + _additionalTimeout_.
42229+
1. NOTE: When _minimumTimeout_ is +∞, _timeout_ is also +∞ and the following step can terminate only by another agent calling NotifyWaiter.
42230+
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.
4222842231
1. Perform EnterCriticalSection(_WL_).
4222942232
1. If _W_ was notified explicitly by another agent calling NotifyWaiter with arguments _WL_ and _W_, return *true*.
4223042233
1. Return *false*.
4223142234
</emu-alg>
42235+
<emu-note>
42236+
<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>
42237+
</emu-note>
4223242238
</emu-clause>
4223342239

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

0 commit comments

Comments
 (0)