HP aC++/HP C A.06.20 Programmer's Guide

ostr << or another /*...*/ << endl;
cout.write(ostr.str().c_str(), ostr.str().length());
Note that cout.flush may be needed if sharing the file with stdio.
Required Command-line Options
To use the multi-thread safe capabilities of the Standard C++ Library, you need to
specify the following options at both compile and link time. Note that the options differ
depending on which set of libraries you are using.
Rogue Wave Standard C++ Library 2.2.1
For both 32-bit and 64-bit libraries:
-D_RWSTD_MULTI_THREAD
-D_REENTRANT
-lpthread (This option applies only to kernel threads.)
-mt
Rogue Wave Standard C++ Library 1.2.1 and Tools.h++ 7.0.6
For both 32-bit and 64-bit libraries:
-D__HPACC_THREAD_SAFE_RB_TREE (Code compiled with this option is binary
incompatible with code that is not compiled with this option. Only HP aC++ version
A.01.21 and subsequent versions incorporate this option.)
-DRWSTD_MULTI_THREAD
-DRW_MULTI_THREAD (needed only for the Tools.h++ Library)
-D_REENTRANT
-lcma (This option applies only to user threads.)
-lpthread (This option applies only to kernel threads.)
-D_THREAD_SAFE (Unlike the other options in this table, this option is not required.
You can use it with the cout, cin, cerr, and clog objects, if you are not using
locks.)
-mt
NOTE: If you do not specify these options as described in both cases, a runtime error
will be generated or multi-thread behavior will be incorrect. If you use +Oopenmp in
an application, you must use -mt on files that are not compiled with +Oopenmp.
Limitations
In most cases, thread safety does not imply that the same object can be shared between
threads. In particular, when objects have user visible state, it would not make sense to
share them between threads. Consider the following:
Using Threads 213