Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

23.1 Multithread-Safe: Level 2

This Rogue Wave implementation of iostreams and locales is Multithread-Safe: Level 2. All public and protected functions are reentrant, and there is protection against multiple threads trying to modify static and global data. The preferred method of protection is mutex locks; the library also locks an object before writing to it. The developer is not required to explicitly lock or unlock a class object, whether static, global, or local, in order to perform a single operation on the object.

This means that iostream objects, with the exception of stream buffers, can be shared between threads of execution using a simple mutex object without explicit locking. The locking mechanism is enforced at the stream level. Therefore, all operations carried out on the stream are multithread safe, including the following:

Thread 1:
Thread 2:
cout << "Thread 1" << endl;
cout << " Thread 2" << endl;


Previous fileTop of DocumentContentsIndexNext file

OEM Edition, ©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.