|
1 | 1 | <cxx-clause id="parallel.exceptions"> |
2 | 2 | <h1>Parallel exceptions</h1> |
3 | | - <cxx-section id="parallel.exceptions.behavior"> |
4 | | - <h1><del>Exception reporting behavior</del></h1> |
5 | | - <del> |
6 | | - <p> |
7 | | - During the execution of a standard parallel algorithm, |
8 | | - if temporary memory resources are required and none are available, |
9 | | - the algorithm throws a <code>std::bad_alloc</code> exception. |
10 | | - </p> |
11 | | - <p> |
12 | | - During the execution of a standard parallel algorithm, if the invocation of an element access function |
13 | | - exits via an uncaught exception, the behavior of the program is determined by the type of |
14 | | - execution policy used to invoke the algorithm: |
15 | | - |
16 | | - <ul> |
17 | | - <li> |
18 | | - If the execution policy object is of type <code>parallel_vector_execution_policy</code>, <code>unsequenced_policy</code>, or <code>vector_policy</code>, |
19 | | - <code>std::terminate</code> shall be called. |
20 | | - </li> |
21 | | - <li> |
22 | | - If the execution policy object is of type <code>sequential_execution_policy</code> or |
23 | | - <code>parallel_execution_policy</code>, the execution of the algorithm exits via an |
24 | | - exception. The exception shall be an <code>exception_list</code> containing all uncaught exceptions thrown during |
25 | | - the invocations of element access functions, or optionally the uncaught exception if there was only one.<pre> |
26 | | -</pre> |
27 | | - |
28 | | - <cxx-note> |
29 | | - For example, when <code>for_each</code> is executed sequentially, |
30 | | - if an invocation of the user-provided function object throws an exception, <code>for_each</code> can exit via the uncaught exception, or throw an <code>exception_list</code> containing the original exception. |
31 | | - </cxx-note><pre> |
32 | | -</pre> |
33 | | - |
34 | | - <cxx-note> |
35 | | - These guarantees imply that, unless the algorithm has failed to allocate memory and |
36 | | - exits via <code>std::bad_alloc</code>, all exceptions thrown during the execution of |
37 | | - the algorithm are communicated to the caller. It is unspecified whether an algorithm implementation will "forge ahead" after |
38 | | - encountering and capturing a user exception. |
39 | | - </cxx-note><pre> |
40 | | -</pre> |
41 | | - <cxx-note> |
42 | | - The algorithm may exit via the <code>std::bad_alloc</code> exception even if one or more |
43 | | - user-provided function objects have exited via an exception. For example, this can happen when an algorithm fails to allocate memory while |
44 | | - creating or adding elements to the <code>exception_list</code> object. |
45 | | - </cxx-note> |
46 | | - </li> |
47 | | - |
48 | | - <li> |
49 | | - If the execution policy object is of any other type, the behavior is implementation-defined. |
50 | | - </li> |
51 | | - </ul> |
52 | | - </p> |
53 | | - </del> |
54 | | - </cxx-section> |
55 | 3 | <cxx-section id="parallel.exceptions.synopsis"> |
56 | 4 | <h1>Header <code><experimental/exception_list></code> synopsis</h1> |
57 | 5 | <pre> |
58 | 6 |
|
59 | | -<del>namespace std {</del> |
60 | | -namespace <ins>std::</ins>experimental { |
61 | | -<ins>inline </ins>namespace parallel<ins>ism_v2</ins> { |
62 | | -<del>inline namespace v2 {</del> |
| 7 | +namespace std::experimental { |
| 8 | +inline namespace parallelism_v2 { |
63 | 9 |
|
64 | 10 | class exception_list : public exception |
65 | 11 | { |
66 | 12 | public: |
67 | | - <del>typedef <em>unspecified</em> iterator;</del> |
68 | | - <ins>using iterator = <em>unspecified</em>;</ins> |
| 13 | + using iterator = <em>unspecified</em>; |
69 | 14 |
|
70 | 15 | size_t size() const noexcept; |
71 | 16 | iterator begin() const noexcept; |
72 | 17 | iterator end() const noexcept; |
73 | 18 |
|
74 | 19 | const char* what() const noexcept override; |
75 | 20 | }; |
76 | | -<del>}</del> |
77 | 21 | } |
78 | 22 | } |
79 | | -<del>}</del> |
80 | 23 | </pre> |
81 | 24 |
|
82 | 25 | <p> |
83 | | - The class <code>exception_list</code> owns a sequence of <code>exception_ptr</code> objects.<del> The parallel |
84 | | - algorithms may use the <code>exception_list</code> to communicate uncaught exceptions encountered during parallel execution to the |
85 | | - caller of the algorithm.</del> |
| 26 | + The class <code>exception_list</code> owns a sequence of <code>exception_ptr</code> objects. |
86 | 27 | </p> |
87 | 28 |
|
88 | 29 | <p> |
89 | | - The type <code>exception_list::iterator</code> shall fulfill the requirements of |
| 30 | + The type <code>exception_list::iterator</code> <ins>fulfills</ins><del>shall fulfill</del> the requirements of |
90 | 31 | <code>ForwardIterator</code>. |
91 | 32 | </p> |
92 | 33 |
|
|
0 commit comments