From d3eb9ee3762b1bc2eba1af8f35f7311e4de790de Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Wed, 17 Sep 2008 19:31:19 +0000 Subject: [PATCH] workaround for SF# 1959059: Poco::SignalHandler deadlock: the SignalHandler can now be disabled globally by adding a #define POCO_NO_SIGNAL_HANDLER to Poco/Config.h --- Foundation/include/Poco/SignalHandler.h | 9 ++++++++- Foundation/src/SignalHandler.cpp | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Foundation/include/Poco/SignalHandler.h b/Foundation/include/Poco/SignalHandler.h index 6bee1ba6b..3b631c2d9 100644 --- a/Foundation/include/Poco/SignalHandler.h +++ b/Foundation/include/Poco/SignalHandler.h @@ -1,7 +1,7 @@ // // SignalHandler.h // -// $Id: //poco/svn/Foundation/include/Poco/SignalHandler.h#2 $ +// $Id: //poco/1.3/Foundation/include/Poco/SignalHandler.h#2 $ // // Library: Foundation // Package: Threading @@ -88,6 +88,9 @@ class Foundation_API SignalHandler /// /// The best way to deal with a SignalException is to log as much context /// information as possible, to aid in debugging, and then to exit. + /// + /// The SignalHandler can be disabled globally by compiling POCO and client + /// code with the POCO_NO_SIGNAL_HANDLER macro defined. { public: SignalHandler(); @@ -129,10 +132,14 @@ private: }; +#ifndef POCO_NO_SIGNAL_HANDLER #define poco_throw_on_signal \ Poco::SignalHandler _poco_signalHandler; \ int _poco_signal = sigsetjmp(_poco_signalHandler.jumpBuffer(), 1); \ if (_poco_signal) _poco_signalHandler.throwSignalException(_poco_signal); +#else +#define poco_throw_on_signal +#endif } // namespace Poco diff --git a/Foundation/src/SignalHandler.cpp b/Foundation/src/SignalHandler.cpp index 3c56eb36f..06447ffd9 100644 --- a/Foundation/src/SignalHandler.cpp +++ b/Foundation/src/SignalHandler.cpp @@ -1,7 +1,7 @@ // // SignalHandler.cpp // -// $Id: //poco/svn/Foundation/src/SignalHandler.cpp#2 $ +// $Id: //poco/1.3/Foundation/src/SignalHandler.cpp#3 $ // // Library: Foundation // Package: Threading @@ -93,6 +93,7 @@ void SignalHandler::throwSignalException(int sig) void SignalHandler::install() { +#ifndef POCO_NO_SIGNAL_HANDLER struct sigaction sa; sa.sa_handler = handleSignal; sa.sa_flags = 0; @@ -101,6 +102,7 @@ void SignalHandler::install() sigaction(SIGBUS, &sa, 0); sigaction(SIGSEGV, &sa, 0); sigaction(SIGSYS, &sa, 0); +#endif }