[c++-pthreads] thread-safety definition
Jakub Jelinek
jakub at redhat.com
Thu Jan 8 13:48:01 UTC 2004
On Thu, Jan 08, 2004 at 02:07:41PM +0100, Mathieu Lacage wrote:
> Maybe it would help to consider the two cases separatly and try to
> figure out what requirements each case creates:
> 1) C++ library calls C++ code and is called by C++ code.
> 2) C++ library calls into C code.
> 3) C code calls C++ library.
>
> The hard part seems to be 2) and 3) where, if you use exceptions to
> propagate a cancel operation from either a cancelation point or a
> pthread_exit call, you need to correctly handle the registered
> cancelation handlers _and_ the C++ catch blocks in the right order. That
> seems pretty hard (ie: impossible) to me, being just a _user_ of thread
> libraries.
It is certainly not impossible, since e.g. NPTL implements it.
It handles several styles of pthread_cleanup_{push,pop} (chained
cleanup structures on the stack, setjmp buffers on the stuck,
__attribute__((cleanup ()))) and C++ destructors.
Jakub
More information about the c++-pthreads
mailing list