|
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>
|
|
0 commit comments