|
VMS Help CXXL, iostream_package, Predefined stream objects synchronization *Conan The Librarian |
Two unparameterized locking and unlocking manipulators, lock and unlock,
are available for use in synchronizing access to the predefined stream
objects: cerr, cin, clog, and cout. If your application needs to lock
two or more of these objects at the same time, the application must
adhere to this locking order:
cin, cerr, clog, cout
The unlocking order is not important.
When your application calls a member function for a predefined stream
object, the member function will typically lock the object for the
duration of the call. Therefore, if your application has locked one of
the stream objects and then uses another, this use must also adhere to
the predefined locking order. For example, your application should not
send output to cerr while cout is locked.
The locking order necessarily matches the default 'ties' between the
stream objects as follows:
cin is tied to cout
cerr is tied to cout
clog is tied to cout
cout has no ties
Any input/output operation on a stream object causes the iostream
Package to flush the object to which it is tied. Thus, an output to
cerr flushes cout.
|
|