diff options
author | Max Kellermann <max@duempel.org> | 2016-06-20 10:25:28 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2016-06-20 10:46:36 +0200 |
commit | 4280f845359af5e40ef408f739afb44fea94fe19 (patch) | |
tree | c8ad9e7329b4cfb9b9ba583d682464021df9eac4 /src/event | |
parent | c3d9c326155a763314eb75856e57c98d135a8dcc (diff) |
event/SignalMonitor: use BoundMethod instead of raw function pointer
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/SignalMonitor.cxx | 6 | ||||
-rw-r--r-- | src/event/SignalMonitor.hxx | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/event/SignalMonitor.cxx b/src/event/SignalMonitor.cxx index 0e1f4b4f4..16e05b1f6 100644 --- a/src/event/SignalMonitor.cxx +++ b/src/event/SignalMonitor.cxx @@ -158,7 +158,7 @@ SignalMonitorFinish() sa.sa_handler = SIG_DFL; for (unsigned i = 0; i < MAX_SIGNAL; ++i) { - if (signal_handlers[i] != nullptr) { + if (signal_handlers[i]) { x_sigaction(i, sa); signal_handlers[i] = nullptr; } @@ -179,7 +179,7 @@ SignalMonitorGetEventLoop() void SignalMonitorRegister(int signo, SignalHandler handler) { - assert(signal_handlers[signo] == nullptr); + assert(!signal_handlers[signo]); #ifndef USE_SIGNALFD assert(!signal_pending[signo]); #endif @@ -209,7 +209,7 @@ SignalMonitor::OnSocketReady(unsigned) int signo; while ((signo = fd.Read()) >= 0) { assert(unsigned(signo) < MAX_SIGNAL); - assert(signal_handlers[signo] != nullptr); + assert(signal_handlers[signo]); signal_handlers[signo](); } diff --git a/src/event/SignalMonitor.hxx b/src/event/SignalMonitor.hxx index fb56a6312..659a84d14 100644 --- a/src/event/SignalMonitor.hxx +++ b/src/event/SignalMonitor.hxx @@ -26,7 +26,9 @@ class EventLoop; #ifndef WIN32 -typedef void (*SignalHandler)(); +#include "util/BindMethod.hxx" + +typedef BoundMethod<void()> SignalHandler; /** * Initialise the signal monitor subsystem. |