Skip to content

Commit d7d681f

Browse files
Dawn Perchikzygoloid
authored andcommitted
P1960R0 NB Comment Changes Reviewed by SG1
Also fixes NB US 355, US 358, US 359, US 356, and US 364 (C++20 CD).
1 parent 2c49b67 commit d7d681f

File tree

2 files changed

+39
-34
lines changed

2 files changed

+39
-34
lines changed

source/atomics.tex

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,8 @@
739739
memory_order = memory_order_seq_cst) const noexcept;
740740

741741
void wait(T, memory_order = memory_order::seq_cst) const noexcept;
742-
void notify_one() noexcept;
743-
void notify_all() noexcept;
742+
void notify_one() const noexcept;
743+
void notify_all() const noexcept;
744744
};
745745
}
746746
\end{codeblock}
@@ -830,7 +830,8 @@
830830
\begin{itemdescr}
831831
\pnum
832832
\returns
833-
\tcode{true} if the object's operations are lock-free,
833+
\tcode{true} if operations on all objects of the type \tcode{atomic_ref<T>}
834+
are lock-free,
834835
\tcode{false} otherwise.
835836
\end{itemdescr}
836837

@@ -1081,7 +1082,7 @@
10811082

10821083
\indexlibrarymember{notify_one}{atomic_ref<T>}%
10831084
\begin{itemdecl}
1084-
void notify_one() noexcept;
1085+
void notify_one() const noexcept;
10851086
\end{itemdecl}
10861087

10871088
\begin{itemdescr}
@@ -1099,7 +1100,7 @@
10991100

11001101
\indexlibrarymember{notify_all}{atomic_ref<T>}%
11011102
\begin{itemdecl}
1102-
void notify_all() noexcept;
1103+
void notify_all() const noexcept;
11031104
\end{itemdecl}
11041105

11051106
\begin{itemdescr}
@@ -1199,8 +1200,8 @@
11991200
@\placeholdernc{integral}@ operator^=(@\placeholdernc{integral}@) const noexcept;
12001201

12011202
void wait(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) const noexcept;
1202-
void notify_one() noexcept;
1203-
void notify_all() noexcept;
1203+
void notify_one() const noexcept;
1204+
void notify_all() const noexcept;
12041205
};
12051206
}
12061207
\end{codeblock}
@@ -1297,7 +1298,7 @@
12971298
atomic_ref& operator=(const atomic_ref&) = delete;
12981299

12991300
void store(@\placeholdernc{floating-point}@, memory_order = memory_order_seq_cst) const noexcept;
1300-
@\placeholder{floating-point}@ operator=(@\placeholder{floating-point}@) noexcept;
1301+
@\placeholder{floating-point}@ operator=(@\placeholder{floating-point}@) const noexcept;
13011302
@\placeholder{floating-point}@ load(memory_order = memory_order_seq_cst) const noexcept;
13021303
operator @\placeholdernc{floating-point}@() const noexcept;
13031304

@@ -1321,8 +1322,8 @@
13211322
@\placeholder{floating-point}@ operator-=(@\placeholder{floating-point}@) const noexcept;
13221323

13231324
void wait(@\placeholdernc{floating-point}@, memory_order = memory_order::seq_cst) const noexcept;
1324-
void notify_one() noexcept;
1325-
void notify_all() noexcept;
1325+
void notify_one() const noexcept;
1326+
void notify_all() const noexcept;
13261327
};
13271328
}
13281329
\end{codeblock}
@@ -1428,8 +1429,8 @@
14281429
T* operator-=(difference_type) const noexcept;
14291430

14301431
void wait(T*, memory_order = memory_order::seq_cst) const noexcept;
1431-
void notify_one() noexcept;
1432-
void notify_all() noexcept;
1432+
void notify_one() const noexcept;
1433+
void notify_all() const noexcept;
14331434
};
14341435
}
14351436
\end{codeblock}
@@ -1492,7 +1493,7 @@
14921493
\indexlibrarymember{operator++}{atomic_ref<T*>}%
14931494
\indexlibrarymember{operator++}{atomic_ref<\placeholder{integral}>}%
14941495
\begin{itemdecl}
1495-
T* operator++(int) const noexcept;
1496+
value_type operator++(int) const noexcept;
14961497
\end{itemdecl}
14971498

14981499
\begin{itemdescr}
@@ -1504,7 +1505,7 @@
15041505
\indexlibrarymember{operator\dcr}{atomic_ref<T*>}%
15051506
\indexlibrarymember{operator\dcr}{atomic_ref<\placeholder{integral}>}%
15061507
\begin{itemdecl}
1507-
T* operator--(int) const noexcept;
1508+
value_type operator--(int) const noexcept;
15081509
\end{itemdecl}
15091510

15101511
\begin{itemdescr}
@@ -1516,7 +1517,7 @@
15161517
\indexlibrarymember{operator++}{atomic_ref<T*>}%
15171518
\indexlibrarymember{operator++}{atomic_ref<\placeholder{integral}>}%
15181519
\begin{itemdecl}
1519-
T* operator++() const noexcept;
1520+
value_type operator++() const noexcept;
15201521
\end{itemdecl}
15211522

15221523
\begin{itemdescr}
@@ -1528,7 +1529,7 @@
15281529
\indexlibrarymember{operator\dcr}{atomic_ref<T*>}%
15291530
\indexlibrarymember{operator\dcr}{atomic_ref<\placeholder{integral}>}%
15301531
\begin{itemdecl}
1531-
T* operator--(int) const noexcept;
1532+
value_type operator--() const noexcept;
15321533
\end{itemdecl}
15331534

15341535
\begin{itemdescr}
@@ -2608,8 +2609,8 @@
26082609
\indexlibrarymember{operator++}{atomic<T*>}%
26092610
\indexlibrarymember{operator++}{atomic<\placeholder{integral}>}%
26102611
\begin{itemdecl}
2611-
T operator++(int) volatile noexcept;
2612-
T operator++(int) noexcept;
2612+
value_type operator++(int) volatile noexcept;
2613+
value_type operator++(int) noexcept;
26132614
\end{itemdecl}
26142615

26152616
\begin{itemdescr}
@@ -2621,8 +2622,8 @@
26212622
\indexlibrarymember{operator\dcr}{atomic<T*>}%
26222623
\indexlibrarymember{operator\dcr}{atomic<\placeholder{integral}>}%
26232624
\begin{itemdecl}
2624-
T operator--(int) volatile noexcept;
2625-
T operator--(int) noexcept;
2625+
value_type operator--(int) volatile noexcept;
2626+
value_type operator--(int) noexcept;
26262627
\end{itemdecl}
26272628

26282629
\begin{itemdescr}
@@ -2634,8 +2635,8 @@
26342635
\indexlibrarymember{operator++}{atomic<T*>}%
26352636
\indexlibrarymember{operator++}{atomic<\placeholder{integral}>}%
26362637
\begin{itemdecl}
2637-
T operator++() volatile noexcept;
2638-
T operator++() noexcept;
2638+
value_type operator++() volatile noexcept;
2639+
value_type operator++() noexcept;
26392640
\end{itemdecl}
26402641

26412642
\begin{itemdescr}
@@ -2647,8 +2648,8 @@
26472648
\indexlibrarymember{operator\dcr}{atomic<T*>}%
26482649
\indexlibrarymember{operator\dcr}{atomic<\placeholder{integral}>}%
26492650
\begin{itemdecl}
2650-
T operator--() volatile noexcept;
2651-
T operator--() noexcept;
2651+
value_type operator--() volatile noexcept;
2652+
value_type operator--() noexcept;
26522653
\end{itemdecl}
26532654

26542655
\begin{itemdescr}

source/threads.tex

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5289,16 +5289,20 @@
52895289
\begin{itemdescr}
52905290
\pnum
52915291
\effects
5292-
\begin{itemize}
5293-
\item
5294-
With low probability, returns immediately.
5295-
An implementation should ensure
5296-
that \tcode{try_acquire} does not consistently return \tcode{false}
5297-
in the absence of contending acquisitions.
5298-
\item
5299-
Otherwise, atomically check whether \tcode{counter} is greater than zero and,
5300-
if so, decrement \tcode{counter} by one.
5301-
\end{itemize}
5292+
Attempts to atomically decrement \tcode{counter} if it is positive,
5293+
without blocking.
5294+
If \tcode{counter} is not decremented, there is no effect and
5295+
\tcode{try_acquire} immediately returns.
5296+
An implementation may fail to decrement \tcode{counter}
5297+
even if it is positive.
5298+
\begin{note}
5299+
This spurious failure is normally uncommon, but
5300+
allows interesting implementations
5301+
based on a simple compare and exchange\iref{atomics}.
5302+
\end{note}
5303+
An implementation should ensure that \tcode{try_acquire}
5304+
does not consistently return \tcode{false}
5305+
in the absence of contending semaphore operations.
53025306

53035307
\pnum
53045308
\returns

0 commit comments

Comments
 (0)