Boost logo

Boost :

From: Anthony Williams (anthwil_at_[hidden])
Date: 2002-08-08 11:10:55

From: Williams, Anthony [PAI01:3497:EXCH]
Sent: 08 August 2002 15:20

You could even provide this behaviour for the main thread of current
systems, by providing a terminate_handler that does thread_terminate, rather
than abort.

A quick bit of experimenting shows that MSVC6 has a terminate_handler per
thread, whereas g++ 3.1 (mingw32) uses a single terminate_handler for all
threads, as does g++3.1 (sparc-solaris-2.7) and Sun Workshop 6u2
(sparc-solaris-2.7), and that setting the terminate_handler to a function
that does the appropriate ExitThread or pthread_exit call works as expected
in all cases, terminating just the thread that caused the violation (either
by leaking an exception, or a throw without a current exception).

I think this is a reasonable position. The only caveat is that if an
exception is thrown before the terminate handler has been set, abort will be
called. This should only be an issue for apps that start threads before main
has begun, and we can ensure that the terminate handler is set when
create_thread is called.


Boost list run by bdawes at, gregod at, cpdaniel at, john at