Will Miles
|
Re: C++ and pthread_cancel
|
Will Miles
01/25/2013 3:44 PM
post98806
|
Re: C++ and pthread_cancel
Hi John,
The QNX pthreads implementation is essentially a C library - it doesn't know anything about C++. Some other clibs
(such as the GNU clib) include specialized code that interacts with the C++ library in the case of thread cancellation
to make it behave as if thread cancellation is a magic, uncatchable exception; this leverages the usual C++ stack
unwinding code to destruct stack local variables.
It is technically possible to port the GNU clib approach to QNX. I have an x86 implementation of something similar,
although I wrote it before finding out that the GNU clib behaves this way (it didn't back when I started on that
project). Consequently my implementation is somewhat crude by comparison, and not easily portable to other
architectures. I did take a look at the GNU implementation, though, and my read of it suggests it should be possible to
port the key bits to operate with the QNX clib, although it would probably involve a dive into the g++ ABI and
exception handling layer. The relevant code is in the nptl sub-library, specifically with regards to stack unwinding.
Hope this helps some,
-Will
|
|
|