mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-06 00:31:10 +01:00
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
This commit is contained in:
parent
c83f8e2434
commit
d3eb9ee376
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SignalHandler.h
|
// SignalHandler.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/include/Poco/SignalHandler.h#2 $
|
// $Id: //poco/1.3/Foundation/include/Poco/SignalHandler.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Threading
|
// Package: Threading
|
||||||
@ -88,6 +88,9 @@ class Foundation_API SignalHandler
|
|||||||
///
|
///
|
||||||
/// The best way to deal with a SignalException is to log as much context
|
/// 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.
|
/// 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:
|
public:
|
||||||
SignalHandler();
|
SignalHandler();
|
||||||
@ -129,10 +132,14 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef POCO_NO_SIGNAL_HANDLER
|
||||||
#define poco_throw_on_signal \
|
#define poco_throw_on_signal \
|
||||||
Poco::SignalHandler _poco_signalHandler; \
|
Poco::SignalHandler _poco_signalHandler; \
|
||||||
int _poco_signal = sigsetjmp(_poco_signalHandler.jumpBuffer(), 1); \
|
int _poco_signal = sigsetjmp(_poco_signalHandler.jumpBuffer(), 1); \
|
||||||
if (_poco_signal) _poco_signalHandler.throwSignalException(_poco_signal);
|
if (_poco_signal) _poco_signalHandler.throwSignalException(_poco_signal);
|
||||||
|
#else
|
||||||
|
#define poco_throw_on_signal
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SignalHandler.cpp
|
// SignalHandler.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/src/SignalHandler.cpp#2 $
|
// $Id: //poco/1.3/Foundation/src/SignalHandler.cpp#3 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Threading
|
// Package: Threading
|
||||||
@ -93,6 +93,7 @@ void SignalHandler::throwSignalException(int sig)
|
|||||||
|
|
||||||
void SignalHandler::install()
|
void SignalHandler::install()
|
||||||
{
|
{
|
||||||
|
#ifndef POCO_NO_SIGNAL_HANDLER
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
sa.sa_handler = handleSignal;
|
sa.sa_handler = handleSignal;
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = 0;
|
||||||
@ -101,6 +102,7 @@ void SignalHandler::install()
|
|||||||
sigaction(SIGBUS, &sa, 0);
|
sigaction(SIGBUS, &sa, 0);
|
||||||
sigaction(SIGSEGV, &sa, 0);
|
sigaction(SIGSEGV, &sa, 0);
|
||||||
sigaction(SIGSYS, &sa, 0);
|
sigaction(SIGSYS, &sa, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user