forked from cplusplus/concurrency-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
N4313.html
277 lines (241 loc) · 11.2 KB
/
N4313.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<html>
<head>
<meta charset="utf-8"/>
<script src="bower_components/platform/platform.js"></script>
<link rel="import" href="bower_components/cxx-html-doc-framework/framework.html"/>
</head>
<body unresolved="">
<!DOCTYPE HTML>
<style>.mydocheader {
float: right;
margin-right: 20px;
}</style>
<PRE class="mydocheader">
Document number: N4313
Revises: N4123
Date: 2014-11-21
Project: Programming Language C++
Reference: ISO/IEC IS 14882:2011(E)
Reply to: Artur Laksberg, Microsoft Corp. arturl@microsoft.com
</PRE>
<br><br><br><br><br><br>
<H1>Improvements to the Concurrency Technical Specification, revision 1</H1>
<cxx-toc></cxx-toc>
<cxx-clause id="introduction">
<h1>Introduction</h1>
<cxx-section id="motivation">
<h1>Motivation and Goals</h1>
<p>
This document proposes improvements to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4107.html">N4107</a>,
the current Working Draft of the Concurrency TS.
</p>
<p>
This document is a revision of
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4123.html">N4123</a>,
which was presented to SG1 and LEWG at the Urbana meeting.
</p>
<p>
This document is motivated by <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4032.html">N4032</a>
and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4048.pdf">N4048</a>,
which were presented to SG1 at the Rapperswil meeting. This document collects the parts of these papers that
received positive feedback from SG1 and presents them as a combined set of proposed changes to
the Concurrency TS.
</p>
<p>
The paper also addresses numerous issues discovered and reported
to the author by various individuals, namely Agustín Bergé,
Vicente J. Botet Escriba, Hartmut Kaiser and Anthony Williams.
</p>
<p>
In addition to the changes proposed in N4123, this document implements the
following suggestions from SG1 and LEWG received at the Urbana meeting:
</p>
<ul>
<li>
Do not introduce <code>std::experimental::async</code> function. This avoids
having to specify execution policies. This also
avoids the question of whether a <code>future</code> created by
<code>async</code> should block in the destructor.
</li>
<li>
Remove <code>when_any_back</code>, and change the return type of
<code>when_any</code> to return the sequence of <code>future</code>s
as well as the index of the ready <code>future</code>.
</li>
</ul>
<p>
Finally, the paper implements a small fix to the signature of <code>make_ready_future</code>
to support <code>reference_wrapper</code> types. This fix was
<a href="https://github.com/cplusplus/concurrency_ts/issues/68">requested</a>
during the Urbana meeting but was <u>not</u> reviewed by SG1 or LEWG.
</p>
<p>
The author seeks feedback from LWG on this document. If approved by LWG, the changes
proposed in this document will be incorporated into the next
Working Paper of the Concurrency TS.
</p>
<cxx-foreign-index id="cxx" src="cxx_N3797_index.json" name="C++14"></cxx-foreign-index></li>
</cxx-section>
<cxx-section id="how-to-read">
<h1>How To Read This Document</h1>
<p>
The proposed changes are presented as "diffs" to N4107 marked as <ins>insertions</ins> and
<del>deletions</del>.
</p>
</cxx-section>
</cxx-clause>
<cxx-clause id="general">
<h1>General</h1>
<cxx-section id="general.namespaces">
<h1>Namespaces, headers, and modifications to standard classes</h1>
<p para_num="1" id="general.namespaces.1"> <del>Some of the extensions described in this Technical Specification represent
types and functions that are currently not part of the C++ Standards Library,
and because these extensions are experimental, they should not be declared
directly within namespace <code>std</code>. Instead, such extensions are
declared in namespace <code>std::experimental</code>.</del>
</p>
<p>
<del>
<cxx-note>
Once standardized, these components are expected to be promoted to namespace <code>std</code>.
</cxx-note>
</del>
</p>
<p>
<del>Unless otherwise specified, references to such entities described in this
Technical Specification are assumed to be qualified with
<code>std::experimental</code>, and references to entities described in the C++
Standard Library are assumed to be qualified with <code>std::</code>.
</del>
</p>
<cxx-ednote>This section reflects the consensus between the LWG and LEWG at the
<a href="http://wiki.edg.com/twiki/bin/view/Wg21chicago2013/FundamentalsTS#What_can_go_into_a_TS">Chicago 2013</a> and
<a href="http://wiki.edg.com/twiki/bin/view/Wg21issaquah/ChangesToExistingInTS">Issaquah 2014</a> meetings.</cxx-ednote>
<p><ins>Since the extensions described in this technical specification
are experimental and not part of the C++ standard library, they
should not be declared directly within namespace
<code>std</code>.
Unless otherwise specified, all components described in this technical specification either:
</p>
</ins>
<ul>
<li><ins>modify an existing interface in the C++ Standard Library in-place,</ins></li>
<li><ins>
are declared in a namespace whose name appends <code>::experimental::concurrency_v1</code>
to a namespace defined in the C++ Standard Library,
such as <code>std</code>, or
</ins></li>
<li><ins>
are declared in a subnamespace of a namespace described in the previous bullet,
whose name is not the same as an existing subnamespace of namespace <code>std</code>.
</ins></li>
</ul>
<p><ins>Each header described in this technical
specification shall import the contents of
<code>std::experimental::concurrency_v1</code> into
<code>std::experimental</code> as if by</p>
</ins>
<pre><ins><code>namespace std {
namespace experimental {
inline namespace concurrency_v1 {}
}
}</code></ins></pre>
<p><ins>Unless otherwise specified, references to other entities
described in this technical specification are assumed to be
qualified with <code>std::experimental::concurrency_v1::</code>,
and references to entities described in the standard are assumed
to be qualified with <code>std::</code>.</ins></p>
<p><ins>Extensions that are expected to eventually be added to an
existing header <code><meow></code> are provided inside the
<code><experimental/meow></code> header, which shall include
the standard contents of <code><meow></code> as if by</ins></p>
<pre><ins><code>#include <meow></code></ins></pre>
<p><ins>New headers are also provided in the
<code><experimental/></code> directory, but without such an
<code>#include</code>.</ins></p>
<table is="cxx-table" id="tab.cxx.headers" class="list" columns="3">
<caption><ins>C++ library headers</ins></caption>
<tr><td>
<ul>
<li><ins><code><experimental/future></code></ins></li>
</ul>
</td></tr>
</table>
</cxx-section>
<cxx-section id="general.plans">
<h1><ins>Future plans (Informative)</ins></h1>
<p><ins>This section describes tentative plans for future versions of
this technical specification and plans for moving content into
future versions of the C++ Standard.</ins></p>
<p><ins>The C++ committee intends to release a new version of this
technical specification approximately every year, containing the
library extensions we hope to add to a near-future version of the
C++ Standard. Future versions will define their contents in
<code>std::experimental::concurrency_v2</code>,
<code>std::experimental::concurrency_v3</code>, etc., with the
most recent implemented version inlined into
<code>std::experimental</code>.</ins></p>
<p><ins>When an extension defined in this or a future version of this
technical specification represents enough existing practice, it
will be moved into the next version of the C++ Standard by
removing the <code>experimental::concurrency_v<var>N</var></code>
segment of its namespace and by removing the
<code>experimental/</code> prefix from its header's path.</ins></p>
</cxx-section>
<cxx-section id="general.feature.test">
<h1><ins>Feature-testing recommendations (Informative)</ins></h1>
<p><ins>
For the sake of improved portability between partial implementations of various C++ standards,
WG21 (the ISO technical committee for the C++ programming language) recommends
that implementers and programmers follow the guidelines in this section concerning feature-test macros.
<cxx-note><a href="http://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations">WG21's SD-6</a> makes similar recommendations for the C++ Standard itself.</cxx-note>
</ins></p>
<p><ins>
Implementers who provide a new standard feature should define a macro with the recommended name,
in the same circumstances under which the feature is available (for example, taking into account relevant command-line options),
to indicate the presence of support for that feature.
Implementers should define that macro with the value specified in
the most recent version of this technical specification that they have implemented.
The recommended macro name is "<code>__cpp_lib_experimental_</code>" followed by the string in the "Macro Name Suffix" column.
</ins></p>
<p><ins>
Programmers who wish to determine whether a feature is available in an implementation should base that determination on
the presence of the header (determined with <code>__has_include(<header/name>)</code>) and
the state of the macro with the recommended name.
(The absence of a tested feature may result in a program with decreased functionality, or the relevant functionality may be provided in a different way.
A program that strictly depends on support for a feature can just try to use the feature unconditionally;
presumably, on an implementation lacking necessary support, translation will fail.)
</ins></p>
<table is="cxx-table" class="column-rules">
<caption><ins>Significant features in this technical specification</ins></caption>
<thead>
<tr>
<th><ins>Doc. No.</ins></th>
<th><ins>Title</ins></th>
<th><ins>Primary Section</ins></th>
<th><ins>Macro Name Suffix</ins></th>
<th><ins>Value</ins></th>
<th><ins>Header</ins></th>
</tr>
</thead>
<!-- These rows are in the same order as their feature appears in this document. -->
<tr>
<td><ins>N3875</ins></td>
<td><ins>Improvements to std::future<T> and Related APIs</ins></td>
<td><ins><cxx-ref to="futures"></cxx-ref></ins></td>
<td><ins><code>future_continuations</code></ins></td>
<td><ins>201410</ins></td>
<td><ins><code><experimental/future></code></ins></td>
</tr>
</table>
</cxx-section>
</cxx-clause>
<cxx-include href="N4313_future.html"></cxx-include>
<cxx-clause id="acknowledgments">
<h1>Acknowledgments</h1>
The author is grateful to Agustín Bergé, Vicente J. Botet Escriba,
Hartmut Kaiser, Stephan T. Lavavej and Anthony Williams for their contributions.
</cxx-clause>
<cxx-publish-button source="https://github.com/cplusplus/concurrent-ts"></cxx-publish-button>
</body>
</html>