Skip to content

Commit 2c49b67

Browse files
authored
Merge 2019-11 LWG Motion 17
P1865R1 Add max() to latch and barrier
2 parents 5149fdf + ee61bbe commit 2c49b67

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

source/threads.tex

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5402,6 +5402,8 @@
54025402
namespace std {
54035403
class latch {
54045404
public:
5405+
static constexpr ptrdiff_t max() noexcept;
5406+
54055407
constexpr explicit latch(ptrdiff_t expected);
54065408
~latch();
54075409

@@ -5429,6 +5431,17 @@
54295431
Concurrent invocations of the member functions of \tcode{latch},
54305432
other than its destructor, do not introduce data races.
54315433

5434+
\indexlibrarymember{max}{latch}%
5435+
\begin{itemdecl}
5436+
static constexpr ptrdiff_t max() noexcept;
5437+
\end{itemdecl}
5438+
5439+
\begin{itemdescr}
5440+
\pnum
5441+
\returns
5442+
The maximum value of \tcode{counter} that the implementation supports.
5443+
\end{itemdescr}
5444+
54325445
\indexlibraryctor{latch}%
54335446
\begin{itemdecl}
54345447
constexpr explicit latch(ptrdiff_t expected);
@@ -5437,7 +5450,8 @@
54375450
\begin{itemdescr}
54385451
\pnum
54395452
\expects
5440-
\tcode{expected >= 0} is \tcode{true}.
5453+
\tcode{expected >= 0} is \tcode{true} and
5454+
\tcode{expected <= max()} is \tcode{true}.
54415455

54425456
\pnum
54435457
\effects
@@ -5559,6 +5573,8 @@
55595573
public:
55605574
using arrival_token = @\seebelow@;
55615575

5576+
static constexpr ptrdiff_t max() noexcept;
5577+
55625578
constexpr explicit barrier(ptrdiff_t expected,
55635579
CompletionFunction f = CompletionFunction());
55645580
~barrier();
@@ -5651,6 +5667,17 @@
56515667
\oldconcept{MoveAssignable} (\tref{cpp17.moveassignable}), and
56525668
\oldconcept{Destructible} (\tref{cpp17.destructible}) requirements.
56535669

5670+
\indexlibrarymember{max}{barrier}%
5671+
\begin{itemdecl}
5672+
static constexpr ptrdiff_t max() noexcept;
5673+
\end{itemdecl}
5674+
5675+
\begin{itemdescr}
5676+
\pnum
5677+
\returns
5678+
The maximum expected count that the implementation supports.
5679+
\end{itemdescr}
5680+
56545681
\indexlibraryctor{barrier}
56555682
\begin{itemdecl}
56565683
constexpr explicit barrier(ptrdiff_t expected,
@@ -5660,7 +5687,8 @@
56605687
\begin{itemdescr}
56615688
\pnum
56625689
\expects
5663-
\tcode{expected >= 0} is \tcode{true}.
5690+
\tcode{expected >= 0} is \tcode{true} and
5691+
\tcode{expected <= max()} is \tcode{true}.
56645692

56655693
\pnum
56665694
\effects

0 commit comments

Comments
 (0)