HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)

Using -D__HPACC_THREAD_SAFE_RB_TREE
The Rogue Wave Standard C++ Library 1.2.1 (libstd) and Tools.h++ 7.0.6
(librwtool) are not thread safe if the underlying implementation rb_tree class is
involved. In other words, if the tree header file (which includes tree.cc) under /opt/
aCC/include/ is used, these libraries are not thread safe. Most likely, it is indirectly
referenced by including the standard C++ library container class map or set headers,
or by including a RogueWave tools.h++ header like tvset.h, tpmset.h, tpmset.h,
tvset.h, tvmset.h, tvmset.h, tpmap.h, tpmmap.h, tpmmap.h, tvmap.h, and
tvmmap.h. Since changing the rb_tree implementation to make it thread safe would
break binary compatibility, the preprocessing macro,
__HPACC_THREAD_SAFE_RB_TREE, must be defined. The macro is automatically
defined in the ItaniumĀ® based environment. A new object file compiled with the macro
defined should not be linked with older ones that were compiled without the macro
defined. Library providers whose library is built with the macro defined may need to
notify their users to also compile their source with the macro defined when the tree header
is included.
Exception Handling
It is illegal to throw out of a thread.
The following example illustrates that you cannot catch an object which has been thrown
in a different thread. To do so will result in a runtime abort since HP aC++ finds no
available catch handler and terminate is called.
#include <pthread.h>
void foo() {
int i = 10;
throw i;
}
int main() {
pthread_t tid;
try {
ret=pthread_create(&tid, 0, (void*(*)(void*))foo, 0);
}
catch(int n) {}
}
Pthreads (POSIX Threads)
Pthreads (POSIX threads) refers to the Pthreads library of thread-management routines.
For information on Pthread routines see the pthread(3t) man page. To use the Pthread
routines, your program must include the <pthreads.h> header file and the Pthreads
library must be explicitly linked to your program.
Example:
aCC -mt prog.c
206 Exception Handling