Skip to content

Commit fdead52

Browse files
committed
[syncstream] Editorial cleanups throughout the wording.
1 parent 26b248e commit fdead52

File tree

1 file changed

+52
-43
lines changed

1 file changed

+52
-43
lines changed

source/iostreams.tex

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9979,14 +9979,6 @@
99799979
\pnum
99809980
The header \tcode{<syncstream>} provides a mechanism
99819981
to synchronize execution agents writing to the same stream.
9982-
It defines class templates \tcode{basic_osyncstream} and \tcode{basic_syncbuf}.
9983-
The latter buffers output and transfer the buffered content
9984-
into an object of type \tcode{basic_streambuf<charT, traits>}
9985-
atomically with respect to such transfers
9986-
by other \tcode{basic_syncbuf<charT, traits, Allocator>} objects
9987-
referring to the same \tcode{basic_streambuf<charT, traits>} object.
9988-
The transfer occurs when \tcode{emit()} is called
9989-
and when the \tcode{basic_syncbuf<charT, traits, Allocator>} object is destroyed.
99909982

99919983
\rSec2[syncstream.syncbuf]{Class template \tcode{basic_syncbuf}}
99929984

@@ -10040,6 +10032,18 @@
1004010032
}
1004110033
\end{codeblock}
1004210034

10035+
\pnum
10036+
Class template \tcode{basic_syncbuf} stores character data
10037+
written to it, known as the associated output, into internal
10038+
buffers allocated using the object's allocator.
10039+
The associated output is transferred to the
10040+
wrapped stream buffer object \tcode{*wrapped}
10041+
when \tcode{emit()} is called
10042+
or when the \tcode{basic_syncbuf} object is destroyed.
10043+
Such transfers are atomic with respect to transfers
10044+
by other \tcode{basic_syncbuf} objects
10045+
with the same wrapped stream buffer object.
10046+
1004310047
\rSec3[syncstream.syncbuf.cons]{Construction and destruction}
1004410048

1004510049
\indexlibrary{\idxcode{basic_syncbuf}!constructor}%
@@ -10051,8 +10055,7 @@
1005110055
\pnum
1005210056
\effects
1005310057
Constructs the \tcode{basic_syncbuf} object and
10054-
sets \tcode{wrapped} to \tcode{obuf}
10055-
which will be the final destination of associated output.
10058+
sets \tcode{wrapped} to \tcode{obuf}.
1005610059

1005710060
\pnum
1005810061
\remarks
@@ -10062,11 +10065,14 @@
1006210065

1006310066
\pnum
1006410067
\throws
10065-
Nothing unless constructing a mutex or allocating memory throws.
10068+
Nothing unless an exception is thrown
10069+
by the construction of a mutex or
10070+
by memory allocation.
1006610071

1006710072
\pnum
1006810073
\postconditions
10069-
\tcode{get_wrapped() == obuf \&\& get_allocator() == allocator}.
10074+
\tcode{get_wrapped() == obuf} and
10075+
\tcode{get_allocator() == allocator} are \tcode{true}.
1007010076
\end{itemdescr}
1007110077

1007210078
\indexlibrary{\idxcode{basic_syncbuf}!constructor}%
@@ -10089,7 +10095,8 @@
1008910095
will be stored in \tcode{*this} afterwards.
1009010096
\tcode{other.rdbuf()->pbase() == other.rdbuf()->pptr()}
1009110097
and
10092-
\tcode{other.get_wrapped() == nullptr}.
10098+
\tcode{other.get_wrapped() == nullptr}
10099+
are \tcode{true}.
1009310100

1009410101
\pnum
1009510102
\remarks
@@ -10110,8 +10117,9 @@
1011010117

1011110118
\pnum
1011210119
\throws
10113-
Nothing. If an exception is thrown from \tcode{emit()},
10114-
that exception is caught and ignored.
10120+
Nothing.
10121+
If an exception is thrown from \tcode{emit()},
10122+
the destructor catches and ignores that exception.
1011510123
\end{itemdescr}
1011610124

1011710125
\rSec3[syncstream.syncbuf.assign]{Assignment and swap}
@@ -10138,9 +10146,9 @@
1013810146
\postconditions
1013910147
\begin{itemize}
1014010148
\item
10141-
\tcode{rhs.get_wrapped() == nullptr}.
10149+
\tcode{rhs.get_wrapped() == nullptr} is \tcode{true}.
1014210150
\item
10143-
\tcode{this->get_allocator() == rhs.get_allocator()} when
10151+
\tcode{this->get_allocator() == rhs.get_allocator()} is \tcode{true} when
1014410152
\begin{codeblock}
1014510153
allocator_traits<Allocator>::propagate_on_container_move_assignment::value
1014610154
\end{codeblock}
@@ -10162,8 +10170,12 @@
1016210170
\begin{itemdescr}
1016310171
\pnum
1016410172
\requires
10173+
Either
1016510174
\tcode{allocator_traits<Allocator>::propagate_on_container_swap::value}
10166-
or \tcode{this->get_allocator() == other.get_allocator()}.
10175+
is \tcode{true}
10176+
or
10177+
\tcode{this->get_allocator() == other.get_allocator()}
10178+
is \tcode{true}.
1016710179

1016810180
\pnum
1016910181
\effects
@@ -10180,27 +10192,27 @@
1018010192
\begin{itemdescr}
1018110193
\pnum
1018210194
\effects
10183-
Atomically transfers the contents of the internal buffer
10195+
Atomically transfers the associated output of \tcode{*this}
1018410196
to the stream buffer \tcode{*wrapped},
10185-
so that they appear in the output stream
10197+
so that it appears in the output stream
1018610198
as a contiguous sequence of characters.
10187-
If and only if a call was made to \tcode{sync()}
10188-
since the last call of \tcode{emit()},
10189-
\tcode{wrapped->pubsync()} is called.
10199+
\tcode{wrapped->pubsync()} is called
10200+
if and only if a call was made to \tcode{sync()}
10201+
since the most recent call to \tcode{emit()}, if any.
1019010202

1019110203
\pnum
1019210204
\returns
1019310205
\tcode{true} if all of the following conditions hold;
1019410206
otherwise \tcode{false}:
1019510207
\begin{itemize}
10196-
\item \tcode{wrapped != nullptr}.
10208+
\item \tcode{wrapped == nullptr} is \tcode{false}.
1019710209
\item All of the characters in the associated output were successfully transferred.
1019810210
\item The call to \tcode{wrapped->pubsync()} (if any) succeeded.
1019910211
\end{itemize}
1020010212

1020110213
\pnum
1020210214
\postconditions
10203-
On success the associated output is empty.
10215+
On success, the associated output is empty.
1020410216

1020510217
\pnum
1020610218
\sync
@@ -10237,7 +10249,7 @@
1023710249
\begin{itemdescr}
1023810250
\pnum
1023910251
\returns
10240-
A copy of the allocator set in the constructor or from assignment.
10252+
A copy of the allocator that was set in the constructor or assignment operator.
1024110253
\end{itemdescr}
1024210254

1024310255
\indexlibrarymember{set_emit_on_sync}{basic_syncbuf}%
@@ -10261,10 +10273,10 @@
1026110273
\begin{itemdescr}
1026210274
\pnum
1026310275
\effects
10264-
Record that the wrapped stream buffer is to be flushed.
10265-
Then, if \tcode{emit_on_sync == true}, calls \tcode{emit()}.
10276+
Records that the wrapped stream buffer is to be flushed.
10277+
Then, if \tcode{emit_on_sync} is \tcode{true}, calls \tcode{emit()}.
1026610278
\begin{note}
10267-
If \tcode{emit_on_sync == false},
10279+
If \tcode{emit_on_sync} is \tcode{false},
1026810280
the actual flush is delayed until a call to \tcode{emit()}.
1026910281
\end{note}
1027010282

@@ -10370,20 +10382,19 @@
1037010382
\begin{itemdescr}
1037110383
\pnum
1037210384
\effects
10373-
Initializes \tcode{sb} from \tcode{buf} and \tcode{allocator} and
10374-
initializes the base class with \tcode{basic_ostream(\&sb)}.
10385+
Initializes \tcode{sb} from \tcode{buf} and \tcode{allocator}.
10386+
Initializes the base class with \tcode{basic_ostream(\&sb)}.
1037510387

1037610388
\pnum
1037710389
\begin{note}
10378-
If the wrapped stream buffer pointer
10379-
refers to a user provided stream buffer
10380-
then its implementation must be aware that its member functions
10390+
The member functions of the provided stream buffer
1038110391
might be called from \tcode{emit()} while a lock is held.
10392+
Care should be taken to ensure that this does not result in deadlock.
1038210393
\end{note}
1038310394

1038410395
\pnum
1038510396
\postconditions
10386-
\tcode{get_wrapped() == buf}.
10397+
\tcode{get_wrapped() == buf} is \tcode{true}.
1038710398
\end{itemdescr}
1038810399

1038910400
\indexlibrary{\idxcode{basic_osyncstream}!constructor}%
@@ -10394,18 +10405,16 @@
1039410405
\begin{itemdescr}
1039510406
\pnum
1039610407
\effects
10397-
Move constructs from \tcode{other}.
10398-
This is accomplished by move constructing the base class,
10399-
and the contained \tcode{basic_syncbuf} \tcode{sb}.
10400-
Next \tcode{basic_ostream<charT, traits>::set_rdbuf(\&sb)}
10401-
is called to install the \tcode{basic_syncbuf} \tcode{sb}.
10408+
Move constructs the base class
10409+
and \tcode{sb} from the corresponding subobjects of \tcode{other},
10410+
and calls \tcode{basic_ostream<charT, traits>::set_rdbuf(\&sb)}.
1040210411

1040310412
\pnum
1040410413
\postconditions
1040510414
The value returned by \tcode{get_wrapped()}
1040610415
is the value returned by \tcode{os.get_wrapped()}
1040710416
prior to calling this constructor.
10408-
\tcode{nullptr == other.get_wrapped()}.
10417+
\tcode{nullptr == other.get_wrapped()} is \tcode{true}.
1040910418
\end{itemdescr}
1041010419

1041110420
\indexlibrary{\idxcode{basic_osyncstream}!destructor}%
@@ -10443,7 +10452,7 @@
1044310452

1044410453
\pnum
1044510454
\postconditions
10446-
\tcode{nullptr == rhs.get_wrapped()}.
10455+
\tcode{nullptr == rhs.get_wrapped()} is \tcode{true}.
1044710456
\tcode{get_wrapped()} returns the value
1044810457
previously returned by \tcode{rhs.get_wrapped()}.
1044910458
\end{itemdescr}
@@ -10459,7 +10468,7 @@
1045910468
\pnum
1046010469
\effects
1046110470
Calls \tcode{sb.emit()}.
10462-
If this call returns \tcode{false},
10471+
If that call returns \tcode{false},
1046310472
calls \tcode{setstate(ios::badbit)}.
1046410473

1046510474
\pnum

0 commit comments

Comments
 (0)