Are exception with gcc 2.95.2 thread-safe?

aurelien.cornet aurelien.cornet@tms.thomson-csf.com
Tue Mar 21 03:47:00 GMT 2000


The usual answer to this question is: 

The ANSI/ISO C++ Professional Programmer's Handbook (Danny Kalev) 
"In a multi-threading environment, exception handling should be
thread-safe, but a single threading environment
can implement exception handling in an non-thread-safe manner; this is
implementation-dependent issue." 

I try the attached progam on Linux, Sun, Aix:
In a main procedure, a try block creates a thread, sleep 2s (let the
thread to be run), then throw an exception. We expected that this
exception will be catched in main and the program terminates. But this
program will never terminate and the result is:
Thread has started 
Exception catched in thread 

Is it a bug? Can we use exception in a multi-threading program?

Best regards. 
Aurelien.
main.C

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.C
Type: text/x-c
Size: 493 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20000321/f6d63ce0/attachment.bin>


More information about the Gcc mailing list