Skip to content

Commit d9a8cd8

Browse files
committed
Apply D4070
1 parent 891797c commit d9a8cd8

File tree

3 files changed

+71
-7
lines changed

3 files changed

+71
-7
lines changed

algorithms.html

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,45 @@ <h1>Effect of execution policies on algorithm execution</h1>
7878
<p>
7979
The applications of function objects in parallel algorithms invoked with an execution policy
8080
of type <code>parallel_vector_execution_policy</code> are permitted to execute in an unordered fashion
81-
in unspecified threads, and unsequenced within each thread.
81+
in unspecified threads, and unsequenced <ins>with respect to one another</ins> within each thread.
82+
8283
<cxx-note>
8384
This means that multiple function object invocations may be interleaved on a single thread.
84-
</cxx-note>
85+
</cxx-note><pre>
86+
</pre>
87+
88+
<del>
8589
<cxx-note>
8690
As a consequence, function objects governed by the <code>parallel_vector_execution_policy</code>
8791
policy must not synchronize with each other. Specifically, they must not acquire locks.
8892
</cxx-note>
93+
</del>
94+
<ins>
95+
<cxx-note>
96+
<ins>This overrides the usual guarantee from the C++ standard, Section 1.9 [intro.execution] that
97+
function executions do not interleave with one another.</ins>
98+
</cxx-note>
99+
</ins>
100+
<pre>
101+
</pre>
102+
103+
<ins>
104+
Since <code>parallel_vector_execution_policy</code> allows the execution of such function objects to be
105+
interleaved on a single thread, synchronization, including the use of mutexes, risks deadlock. Thus the
106+
synchronization with <code>parallel_vector_execution_policy</code> is restricted as follows:<pre>
107+
</pre>
108+
109+
A standard library function is <em>vectorization-unsafe</em> if it is specified to synchronize with
110+
another function invocation, or another function invocation is specified to synchronize with it, and if
111+
it is not a memory allocation or deallocation function. Vectorization-unsafe standard library functions
112+
may not be invoked by user code called from <code>parallel_vector_execution_policy</code> algorithms.<pre>
113+
</pre>
114+
115+
<cxx-note>
116+
Implementations must ensure that internal synchronization inside standard library routines does not
117+
induce deadlock.
118+
</cxx-note>
119+
</ins>
89120
</p>
90121

91122
<cxx-example><pre>

parallelism-ts.html

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,21 +1560,54 @@ <h1>Contents</h1>
15601560
<p para_num="4" id="parallel.alg.general.exec.4">
15611561
The applications of function objects in parallel algorithms invoked with an execution policy
15621562
of type <code>parallel_vector_execution_policy</code> are permitted to execute in an unordered fashion
1563-
in unspecified threads, and unsequenced within each thread.
1563+
in unspecified threads, and unsequenced <ins>with respect to one another</ins> within each thread.
1564+
15641565
<cxx-note><span class="nowrap">[ <em>Note:</em></span>
15651566

15661567
This means that multiple function object invocations may be interleaved on a single thread.
15671568

15681569
<span class="nowrap"><em>end note</em> ]</span>
1569-
</cxx-note>
1570+
</cxx-note></p><pre></pre>
1571+
1572+
<del>
15701573
<cxx-note><span class="nowrap">[ <em>Note:</em></span>
15711574

15721575
As a consequence, function objects governed by the <code>parallel_vector_execution_policy</code>
15731576
policy must not synchronize with each other. Specifically, they must not acquire locks.
15741577

15751578
<span class="nowrap"><em>end note</em> ]</span>
15761579
</cxx-note>
1577-
</p>
1580+
</del>
1581+
<ins>
1582+
<cxx-note><span class="nowrap">[ <em>Note:</em></span>
1583+
1584+
<ins>This overrides the usual guarantee from the C++ standard, Section 1.9 [intro.execution] that
1585+
function executions do not interleave with one another.</ins>
1586+
1587+
<span class="nowrap"><em>end note</em> ]</span>
1588+
</cxx-note>
1589+
</ins>
1590+
<pre></pre>
1591+
1592+
<ins>
1593+
Since <code>parallel_vector_execution_policy</code> allows the execution of such function objects to be
1594+
interleaved on a single thread, synchronization, including the use of mutexes, risks deadlock. Thus the
1595+
synchronization with <code>parallel_vector_execution_policy</code> is restricted as follows:<pre></pre>
1596+
1597+
A standard library function is <em>vectorization-unsafe</em> if it is specified to synchronize with
1598+
another function invocation, or another function invocation is specified to synchronize with it, and if
1599+
it is not a memory allocation or deallocation function. Vectorization-unsafe standard library functions
1600+
may not be invoked by user code called from <code>parallel_vector_execution_policy</code> algorithms.<pre></pre>
1601+
1602+
<cxx-note><span class="nowrap">[ <em>Note:</em></span>
1603+
1604+
Implementations must ensure that internal synchronization inside standard library routines does not
1605+
induce deadlock.
1606+
1607+
<span class="nowrap"><em>end note</em> ]</span>
1608+
</cxx-note>
1609+
</ins>
1610+
<p para_num="5" id="parallel.alg.general.exec.5"></p>
15781611

15791612
<cxx-example>
15801613

@@ -1613,12 +1646,12 @@ <h1>Contents</h1>
16131646
<span class="nowrap"><em>end note</em> ]</span>
16141647
</cxx-note>
16151648

1616-
<p para_num="5" id="parallel.alg.general.exec.5">
1649+
<p para_num="6" id="parallel.alg.general.exec.6">
16171650
Algorithms invoked with an execution policy object of type <code>execution_policy</code>
16181651
execute internally as if invoked with the contained execution policy object.
16191652
</p>
16201653

1621-
<p para_num="6" id="parallel.alg.general.exec.6">
1654+
<p para_num="7" id="parallel.alg.general.exec.7">
16221655
The semantics of parallel algorithms invoked with an execution policy object of
16231656
implementation-defined type are implementation-defined.
16241657
</p>

parallelism-ts.pdf

2.16 KB
Binary file not shown.

0 commit comments

Comments
 (0)