<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
  <head>
    <title>N3071: Renaming launch::any and what asyncs really might be (Rev.)</title>
<style type="text/css">
ins {background-color:#A0FFA0}
del {background-color:#FFA0A0}
</style>
  </head>

  <body>
<table>
  <tr>
    <td align="left">Document Number:</td>
    <td align="left">N3071=10-0061</td>
  </tr>
  <tr>
    <td align="left">Date:</td>
    <td align="left">2010-03-10</td>
  </tr>
  <tr>
    <td align="left">Project:</td>
    <td align="left">Programming Language C++</td>
  </tr>
</table>
<p>
Detlef Vollmann &lt;<a href="mailto:dv@vollmann.ch">dv@vollmann.ch</a>&gt;<br/>
</p>
<h1>N3071: Renaming launch::any and what asyncs really might be (Rev.)</h1>

<h2>Introduction</h2>
<p>
N2996 introduced two new function calls <code>async</code> to start
some function asynchronously and return a future
to obtain the result of the function.
N2996 allowed for two mechanisms to run that function: in another thread
or as deferred function in the same thread.
</p>

<h2>Discussion</h2>
<p>
The two launching mechanisms defined by N2996 make sense for the current
revision of the standard, but future revisions of C++ might allow for
a much larger variety of launching mechanisms.
Some potential mechanisms might be:
</p>
<ul>
  <li>launching in a specific thread pool</li>
  <li>launching in a separate process</li>
  <li>launching on a different computing unit (such as GPU)</li>
  <li>launching on a different machine (e.g. through MPI)</li>
  <li>...</li>
</ul>
<p>
Some of these future mechanisms might want to use the existing
<code>async</code> function, just with a different launch policy.
With this in mind, the naming of <code>launch::any</code> is
unfortunate, as it only allows for "calling in another thread"
and "calling in the same thread".
</p>
<p>So I propose to change <code>launch::any</code> to
<code>launch::sync_or_async</code>.
</p>

<h2>Proposed Changes</h2>
<p>
In 30.6.1 [futures.overview], header <code>&lt;future&gt;</code> synopsis, <code>enum class launch</code>:<br/>
Change:
</p>
<pre>
<del>any</del><ins>sync_or_async</ins>
</pre>

<p>
In 30.6.9 [futures.async], paragraph 2, Effects clause:<br/>
Change:
</p>
<p>
<em>Effects:</em>
<p>
The first function behaves the same as a call to the second function
with a policy argument of <code>launch::<del>any</del><ins>sync_or_async</ins></code> and
the same arguments for <code>F</code> and <code>Args</code>.
</p>
<p>And in the tird bullet:<br/>
Change:
</p>
<ul><li><code>launch::<del>any</del><ins>sync_or_async</ins></code> &mdash; the implementation may choose either
      policy above at any call to <code>async</code>.</li></ul>

</body>
</html>




