@@ -92,16 +92,46 @@ <h1>Effect of execution policies on algorithm execution</h1>
92
92
in parallel algorithms invoked with an execution policy of type
93
93
< code > < del2 > vector_execution_policy</ del2 > < ins2 > parallel_vector_execution_policy</ ins2 > </ code >
94
94
are permitted to execute in an unordered fashion in unspecified threads, and unsequenced
95
- within each thread.
95
+ < ins3 > with respect to one another </ ins3 > within each thread.
96
96
< ins2 >
97
97
< cxx-note >
98
98
This means that multiple function object invocations may be interleaved on a single thread.
99
99
</ cxx-note >
100
- </ ins2 >
100
+ </ ins2 > < pre >
101
+ </ pre >
102
+
103
+ < del3 >
101
104
< cxx-note >
102
105
As a consequence, function objects governed by the < code > < del2 > vector_execution_policy</ del2 > < ins2 > parallel_vector_execution_policy</ ins2 > </ code >
103
106
policy must not synchronize with each other. Specifically, they must not acquire locks.
104
107
</ cxx-note >
108
+ </ del3 >
109
+
110
+ < ins3 >
111
+ < cxx-note >
112
+ This overrides the usual guarantee from the C++ standard, Section 1.9 [intro.execution] that
113
+ function executions do not interleave with one another.
114
+ </ cxx-note >
115
+ </ ins3 > < pre >
116
+ </ pre >
117
+
118
+ < ins3 >
119
+ Since < code > parallel_vector_execution_policy</ code > allows the execution of element access functions to be
120
+ interleaved on a single thread, synchronization, including the use of mutexes, risks deadlock. Thus the
121
+ synchronization with < code > parallel_vector_execution_policy</ code > is restricted as follows:< pre >
122
+ </ pre >
123
+
124
+ A standard library function is < em > vectorization-unsafe</ em > if it is specified to synchronize with
125
+ another function invocation, or another function invocation is specified to synchronize with it, and if
126
+ it is not a memory allocation or deallocation function. Vectorization-unsafe standard library functions
127
+ may not be invoked by user code called from < code > parallel_vector_execution_policy</ code > algorithms.< pre >
128
+ </ pre >
129
+
130
+ < cxx-note >
131
+ Implementations must ensure that internal synchronization inside standard library routines does not
132
+ induce deadlock.
133
+ </ cxx-note >
134
+ </ ins3 >
105
135
</ p >
106
136
107
137
< cxx-example > < pre >
0 commit comments