C++ Library Reference

Multithreading

Multi-threading (MT) is a powerful facility that can speed up applications on multiprocessors; it can also simplify the structuring of applications on both multiprocessors and uniprocessors. The iostream library has been modified to allow its interfaces to be used by applications in a multithreaded environment by programs that utilize the multithreading capabilities when running Solaris version 2.2, 2.3, 2.4, 2.5, 2.5.1, 2.6, or 7. Applications that utilize the single-threaded capabilities of previous versions of the library are not affected by the behavior of the modified iostream interfaces.

A library is defined to be MT-safe if it works correctly in an environment with threads. Generally, this "correctness" means that all of its public functions are reentrant. The iostream library provides protection against multiple threads that attempt to modify the state of objects (that is, instances of a C++ class) shared by more than one thread. However, the scope of MT-safety for an iostream object is confined to the period in which the object's public member function is executing.


Caution - Caution -

An application is not automatically guaranteed to be MT-safe because it uses MT-safe objects from the libC library. An application is defined to be MT-safe only when it executes as expected in a multithreaded environment.