- c++ exception and thread death
- Posted by viki on May 12th, 2008
Unhandled c++ exception in one thread is supposed to bring down the
whole process, correct ?
Sometimes we observe that unhandled c++ exception kills the thread,
the process continues (other threads).
What could cause process not being killed by unhandled c++ exception
in one thread ?
Thanks
Viki
- Posted by Sebastian G. on May 12th, 2008
viki wrote:
At least on Windows, where exceptions really represent exceptional
conditions and thus the CRT's default unhandled exception filter dares to
terminate the entire process.
Setting up your own unhandled exception filter. Though you're strongly
discouraged from doing so.
- Posted by boris on May 12th, 2008
"viki" <vikimun@gmail.com> wrote in message
news:0f508f55-6ca6-47bc-8eb8-1036b7a2b0cc@b64g2000hsa.googlegroups.com...
As this the above link says, default unhandled exception handler calls CRT
exit(). I observed cases when calling exit() in multi-threaded program
didn't cause process to terminate. On the other side, Win32 ExitProcess()
always worked for me - never saw it hang. Behaivior of CRT exit() can be
modified, by calling onexit() for example - if onexit() handler hangs,
process will hang.
Also, SEH exceptions don't cause C++ exceptions to be thrown and are handled
by SEH handler (also see Win32 SetUnhandledExceptionFilter()).
Boris