Stream locks are obtained and released in public member functions of basic_ios, basic_istream, basic_ostream, basic_ifstream, basic_ofstream, basic_istringstream, basic_ostringstream, and strstream. This means that all calls to public member functions of these classes are safe.
Stream buffer locks are obtained in the constructor of the sentry object contained in both basic_istream and basic_ostream, and released in the destructor. Calls to member functions of stream buffers are not safe. The buffer must be locked explicitly before the function is called, and unlocked after the function returns.
A stream buffer lock can be obtained by explicitly calling the member function _RW_lock_buffer() provided by basic_streambuf. The lock is released by calling _RW_release_buffer(), or you can use the lock and unlock manipulators as shown above. These functions are provided as extensions to the Standard C++ Library definition, but are contained in the std namespace.
OEM Edition, OEM Edition, ©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.