From 2eb849b91cf2cd3e9254256a0c26a56f66c779ac Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 8 Oct 2008 22:44:32 +0000 Subject: [PATCH] Fix segfault on linux - catch(...) must not call std::unexpected() --- src/libCom/osi/epicsThread.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libCom/osi/epicsThread.cpp b/src/libCom/osi/epicsThread.cpp index 02870bed7..4f53eb284 100644 --- a/src/libCom/osi/epicsThread.cpp +++ b/src/libCom/osi/epicsThread.cpp @@ -73,11 +73,14 @@ extern "C" void epicsThreadCallEntryPoint ( void * pPvt ) errlogPrintf ( "epicsThread: Unknown C++ exception in thread \"%s\" at %s\n", name, date ); - // this should behave as the C++ implementation intends when an - // exception isnt handled. If users dont like this behavior, they - // can install an application specific unexpected handler. - std::unexpected (); + errlogFlush (); } + // The Linux NPTL library requires us to re-throw here; it uses + // an untyped exception object to shut down threads when we call + // pthread_cancel() in the os/posix/osdThread.c myAtExit() + // handler, and aborts with "FATAL: exception not rethrown" if + // we don't re-throw it. This solution is incomplete though... + throw; } if ( ! waitRelease ) { epicsGuard < epicsMutex > guard ( pThread->mutex );