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

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
Limitations
When using STL containers as local objects, the destructor will not get called when
pthread_exit is called, which leads to a memory leak. Do not call pthread_exit
from C++. Instead you must throw or return back to the thread’s initial function. There
you can do a return instead of pthread_exit.
Pthreads (POSIX Threads) 215