Cancelling threads and C++ (LinuxThreads)
Richard Henderson
rth@twiddle.net
Wed Jun 30 15:43:00 GMT 1999
On Mon, Jun 28, 1999 at 10:03:20AM -0400, george@moberg.com wrote:
> This work-around works. However, I've corresponded with Dave Butenhof, who
> wrote "Programming with POSIX Threads". His opinion was that this solution
> isn't portable, and that the library implementing pthreads should see to it
> that destructors for stack-based objects are called without my program having
> to do anything special.
As quality-of-implementation, that's true. But pedanticly, the standard
(being for C) doesn't say anything about C++, and so relying on the
implementation to call destructors is also not portable.
> Is a patch to LinuxThreads to implement the throw/catch mechanism
> for cancelling threads appropriate? This would include the -fexceptions
> compile option for the entire C library.
I would not be opposed to it. Drepper would make the final decision.
> Would this require that a single mechanism for exceptions be used,
> rather than the two that are available in egcs now? (-fnew-exceptions
> vs. -fsjlj-exceptions)
Actually, the two mechanisms are -fsjlj-exceptions and -fno-sjlj-exceptions.
-fnew-exceptions does something different, and is forward compatible with
-fno-sjlj-exceptions.
But yes, you would be limited to one of -f{no-}sjlj-exceptions.
r~
More information about the Gcc
mailing list