@@ -1560,21 +1560,54 @@ <h1>Contents</h1>
1560
1560
< p para_num ="4 " id ="parallel.alg.general.exec.4 ">
1561
1561
The applications of function objects in parallel algorithms invoked with an execution policy
1562
1562
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
+
1564
1565
< cxx-note > < span class ="nowrap "> [ < em > Note:</ em > </ span >
1565
1566
1566
1567
This means that multiple function object invocations may be interleaved on a single thread.
1567
1568
1568
1569
< span class ="nowrap "> — < em > end note</ em > ]</ span >
1569
- </ cxx-note >
1570
+ </ cxx-note > </ p > < pre > </ pre >
1571
+
1572
+ < del >
1570
1573
< cxx-note > < span class ="nowrap "> [ < em > Note:</ em > </ span >
1571
1574
1572
1575
As a consequence, function objects governed by the < code > parallel_vector_execution_policy</ code >
1573
1576
policy must not synchronize with each other. Specifically, they must not acquire locks.
1574
1577
1575
1578
< span class ="nowrap "> — < em > end note</ em > ]</ span >
1576
1579
</ 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 >
1578
1611
1579
1612
< cxx-example >
1580
1613
@@ -1613,12 +1646,12 @@ <h1>Contents</h1>
1613
1646
< span class ="nowrap "> — < em > end note</ em > ]</ span >
1614
1647
</ cxx-note >
1615
1648
1616
- < p para_num ="5 " id ="parallel.alg.general.exec.5 ">
1649
+ < p para_num ="6 " id ="parallel.alg.general.exec.6 ">
1617
1650
Algorithms invoked with an execution policy object of type < code > execution_policy</ code >
1618
1651
execute internally as if invoked with the contained execution policy object.
1619
1652
</ p >
1620
1653
1621
- < p para_num ="6 " id ="parallel.alg.general.exec.6 ">
1654
+ < p para_num ="7 " id ="parallel.alg.general.exec.7 ">
1622
1655
The semantics of parallel algorithms invoked with an execution policy object of
1623
1656
implementation-defined type are implementation-defined.
1624
1657
</ p >
0 commit comments