aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/SignalHandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/SignalHandler.cc')
-rw-r--r--src/FbTk/SignalHandler.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/FbTk/SignalHandler.cc b/src/FbTk/SignalHandler.cc
index a0a4c4c..5f06210 100644
--- a/src/FbTk/SignalHandler.cc
+++ b/src/FbTk/SignalHandler.cc
@@ -46,6 +46,7 @@ bool SignalHandler::registerHandler(int signum, SignalEventHandler *eh,
46 if (oldhandler_ret != 0) 46 if (oldhandler_ret != 0)
47 *oldhandler_ret = s_signal_handler[signum]; 47 *oldhandler_ret = s_signal_handler[signum];
48 48
49#ifdef HAVE_SIGACTION
49 struct sigaction sa; 50 struct sigaction sa;
50 // set callback 51 // set callback
51 sa.sa_handler = SignalHandler::handleSignal; 52 sa.sa_handler = SignalHandler::handleSignal;
@@ -54,7 +55,12 @@ bool SignalHandler::registerHandler(int signum, SignalEventHandler *eh,
54 55
55 if (sigaction(signum, &sa, 0) == -1) 56 if (sigaction(signum, &sa, 0) == -1)
56 return false; 57 return false;
57 58#else
59 // Fallback code for Windows and other platforms lacking sigaction.
60 if (signal(signum, &SignalHandler::handleSignal) == SIG_ERR) {
61 return false;
62 }
63#endif
58 s_signal_handler[signum] = eh; 64 s_signal_handler[signum] = eh;
59 65
60 return true; 66 return true;