Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Fixes #57
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars T Hansen committed Mar 24, 2016
1 parent d742910 commit d1f848f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
17 changes: 12 additions & 5 deletions tc39/shmem.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ <h1><span class="secnum"></span>Introduction<span class="utils"><span class="anc

<p>Changelog:</p>
<ul>
<li> 2016-03-24 -- (Issue 46) Atomics.isLockFree(4) is guaranteed to return true
<li> 2016-03-24 -- (Issue 57) Added a note on how wait/wake can be throttled.

</li><li> 2016-03-24 -- Removed an orphan note.

</li><li> 2016-03-24 -- (Issue 46) Atomics.isLockFree(4) is guaranteed to return true

</li><li> 2016-03-24 -- (Issue 12) Removed references to the proposed "synchronic" spec, it was withdrawn

Expand Down Expand Up @@ -795,6 +799,13 @@ <h1><span class="secnum">7.2.11</span>Runtime semantics: WakeWaiter( W )<span cl
<p> When WakeWaiter is called with an agent signifier <var>W</var>, then the following steps are taken. </p>
<emu-alg><ol><li>Assert: The calling agent is in the futex critical section.</li><li>Assert: <var>W</var> is on some global list of waiters</li><li>Wake the agent <var>W</var>
</li></ol></emu-alg>

<emu-note><span class="note">Note</span>
<p> The embedding may delay waking <var>W</var>, eg for resource
management reasons, but <var>W</var> must eventually be woken in
order to guarantee forward progress. </p>
</emu-note>

</emu-clause>

</emu-clause> <!-- runtime semantics -->
Expand Down Expand Up @@ -844,10 +855,6 @@ <h1><span class="secnum">7.3.6</span>Atomics.futexWake( typedArray, index, count
<p> Atomics.futexWake wakes up some agents that are sleeping in the wait queue. The following steps are taken: </p>
<emu-alg><ol><li>Let <var>buffer</var> be <emu-xref aoid="ValidateSharedIntegerTypedArray"><a href="#Atomics.ValidateSharedIntegerTypedArray">ValidateSharedIntegerTypedArray</a></emu-xref>( <var>typedArray</var>, <emu-const>true</emu-const> )</li><li><emu-xref aoid="ReturnIfAbrupt"><a href="https://tc39.github.io/ecma262/#sec-returnifabrupt">ReturnIfAbrupt</a></emu-xref>( <var>buffer</var> )</li><li>Let <var>i</var> be <emu-xref aoid="ValidateAtomicAccess"><a href="#Atomics.ValidateAtomicAccess">ValidateAtomicAccess</a></emu-xref>( <var>typedArray</var>, <var>index</var> )</li><li><emu-xref aoid="ReturnIfAbrupt"><a href="https://tc39.github.io/ecma262/#sec-returnifabrupt">ReturnIfAbrupt</a></emu-xref>( <var>i</var> )</li><li>If <var>count</var> is not provided or is <emu-const>undefined</emu-const> then let <var>c</var> be +Infinity. Otherwise:<ol><li>Let <var>tmp</var> be <emu-xref aoid="ToInteger"><a href="https://tc39.github.io/ecma262/#sec-tointeger">ToInteger</a></emu-xref>( <var>count</var> )</li><li><emu-xref aoid="ReturnIfAbrupt"><a href="https://tc39.github.io/ecma262/#sec-returnifabrupt">ReturnIfAbrupt</a></emu-xref>( <var>tmp</var> )</li><li>Let <var>c</var> be <emu-xref aoid="max"><a href="https://tc39.github.io/ecma262/#sec-algorithm-conventions">max</a></emu-xref>( +0, <var>tmp</var> ).</li></ol></li><li>Let <var>bufferVal</var> be the value of the internal [[SharedArrayBufferData]] property of <var>buffer</var>.</li><li>Let <var>G</var> be <emu-xref aoid="SharedDataBlockID"><a href="#DataTypesValues.SpecTypes.DataBlocks.SharedDataBlockID">SharedDataBlockID</a></emu-xref>( <var>bufferVal</var> )</li><li>Let <var>n</var> = 0</li><li>Within the futex critical section do:<ol><li>Let <var>S</var> be <emu-xref aoid="RemoveWaiters"><a href="#Atomics.RemoveWaiters">RemoveWaiters</a></emu-xref>( <var>G</var>, <var>i</var>, <var>c</var> )</li><li>While <var>S</var> is not the empty list:<ol><li>Let <var>W</var> be the first agent in <var>S</var></li><li>Remove <var>W</var> from the front of <var>S</var></li><li>Call <emu-xref aoid="WakeWaiter"><a href="#Atomics.WakeWaiter">WakeWaiter</a></emu-xref>( <var>W</var> )</li><li>Add 1 to <var>n</var></li></ol></li></ol></li><li>Return <var>n</var>.
</li></ol></emu-alg>

<emu-note><span class="note">Note</span>
<p> (<a href="https://github.com/tc39/ecmascript_sharedmem/issues/63">Issue 63</a>) The count argument should probably default to "all", in the manner of the timeout argument for futexWait. </p>
</emu-note>
</emu-clause>

<emu-clause id="Atomics.futexWakeOrRequeue">
Expand Down
13 changes: 9 additions & 4 deletions tc39/spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ <h1>Introduction</h1>

<p>Changelog:</p>
<ul>
<li> 2016-03-24 -- (Issue 57) Added a note on how wait/wake can be throttled.
<li> 2016-03-24 -- Removed an orphan note.
<li> 2016-03-24 -- (Issue 46) Atomics.isLockFree(4) is guaranteed to return true
<li> 2016-03-24 -- (Issue 12) Removed references to the proposed "synchronic" spec, it was withdrawn
<li> 2016-03-18 -- (Issue 22, 51, 71) Flesh out the memory model.
Expand Down Expand Up @@ -851,6 +853,13 @@ <h1>Runtime semantics: WakeWaiter( W )</h1>
1. Assert: _W_ is on some global list of waiters
1. Wake the agent _W_
</emu-alg>

<emu-note>
<p> The embedding may delay waking _W_, eg for resource
management reasons, but _W_ must eventually be woken in
order to guarantee forward progress. </p>
</emu-note>

</emu-clause>

</emu-clause> <!-- runtime semantics -->
Expand Down Expand Up @@ -979,10 +988,6 @@ <h1>Atomics.futexWake( typedArray, index, count )</h1>
1. Add 1 to _n_
1. Return _n_.
</emu-alg>

<emu-note>
<p> (<a href="https://github.com/tc39/ecmascript_sharedmem/issues/63">Issue 63</a>) The count argument should probably default to "all", in the manner of the timeout argument for futexWait. </p>
</emu-note>
</emu-clause>

<emu-clause id="Atomics.futexWakeOrRequeue">
Expand Down

0 comments on commit d1f848f

Please sign in to comment.