Skip to content

Commit

Permalink
[WIP] Add Atomics.waitAsync host hook
Browse files Browse the repository at this point in the history
This host hook queues a task in the appropriate agent to resolve a Promise.

Corresponding PR: tc39/proposal-atomics-wait-async#7
  • Loading branch information
littledan committed May 11, 2019
1 parent c04117f commit 46cd878
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3116,6 +3116,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

<p>User agents that support JavaScript must also implement the <cite>BigInt</cite> proposal. <ref
spec=JSBIGINT></p>

<p>User agents that support JavaScript must also implement the <cite>Atomics.waitAsync</cite>
proposal. The following term is defined there, and used in this specification: <ref
spec=JSWAITASYNC></p>

<ul class="brief">
<li>The <dfn data-x="js-HostResolveInAgent" data-x-href="https://tc39.github.io/proposal-atomics-wait-async/#sec-hostresolveinagent">HostResolveInAgent</dfn> abstract operation</li>
</ul>
</dd>


Expand Down Expand Up @@ -89465,6 +89473,22 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {

</ol>

<h5><dfn data-x="the-hostresolveinagent-implementation">HostResolveInAgent</dfn>(<var>agentSignifier</var>, <var>promiseCapability</var>, <var>resolution</var>)</h5>

<p>The <cite>Atomics.waitAsync</cite> specification relies on the host to trigger the resolution of a <code data-x="">Promise</code> in another <span>agent</span>. This specification defines that algorithm as follows: <ref spec=JSWAITASYNC></p>

<ol>
<li><p>Let <var>agent</var> be the <span>agent</span> corresponding to <var>agentSignifier</var>.</p></li>
<li>
<p><span>Queue a task</span> on the <span>Atomics.waitAsync task source</span> in <var>agent</var>'s <span>event loop</span> to run the following steps:</p>
<ol>
<li>Perform ! <span>Call</span>(<var>promiseCapability</var>.[[Resolve]], undefined, &laquo; <var>resolution</var> &raquo;).</li>
</ol>
</li>
</ol>

<p>The <span>task source</span> for these <span data-x="concept-task">tasks</span> in this section is the <dfn>Atomics.waitAsync task source</dfn>.</p>

</div>

<h4>Event loops</h4> <!-- <dfn>event loop</dfn> -->
Expand Down Expand Up @@ -121967,6 +121991,9 @@ INSERT INTERFACES HERE
<dt id="refsJSON">[JSON]</dt>
<dd><cite><a href="https://tools.ietf.org/html/rfc7159">The JavaScript Object Notation (JSON) Data Interchange Format</a></cite>, T. Bray. IETF.</dd>

<dt id="refsJSWAITASYNC">[JSWAITASYNC]</dt>
<dd><cite><a href="https://tc39.github.io/proposal-atomics-wait-async/">Atomics.waitAsync</a></cite>. Ecma International.</dd>

<dt id="refsLONGTASKS">[LONGTASKS]</dt>
<dd><cite><a href="https://w3c.github.io/longtasks/">Long Tasks</a></cite>, D. Denicola, I. Grigorik, S. Panicker. W3C.</dd>

Expand Down

0 comments on commit 46cd878

Please sign in to comment.