summaryrefslogtreecommitdiff
path: root/src/unix
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2016-06-20 10:25:28 +0200
committerMax Kellermann <max@duempel.org>2016-06-20 10:46:36 +0200
commit4280f845359af5e40ef408f739afb44fea94fe19 (patch)
treec8ad9e7329b4cfb9b9ba583d682464021df9eac4 /src/unix
parentc3d9c326155a763314eb75856e57c98d135a8dcc (diff)
event/SignalMonitor: use BoundMethod instead of raw function pointer
Diffstat (limited to 'src/unix')
-rw-r--r--src/unix/SignalHandlers.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/unix/SignalHandlers.cxx b/src/unix/SignalHandlers.cxx
index 3f4af5ffb..9bed3df08 100644
--- a/src/unix/SignalHandlers.cxx
+++ b/src/unix/SignalHandlers.cxx
@@ -34,9 +34,10 @@
static constexpr Domain signal_handlers_domain("signal_handlers");
static void
-HandleShutdownSignal()
+HandleShutdownSignal(void *ctx)
{
- SignalMonitorGetEventLoop().Break();
+ auto &loop = *(EventLoop *)ctx;
+ loop.Break();
}
static void
@@ -47,7 +48,7 @@ x_sigaction(int signum, const struct sigaction *act)
}
static void
-handle_reload_event(void)
+handle_reload_event(void *)
{
LogDebug(signal_handlers_domain, "got SIGHUP, reopening log files");
cycle_log_files();
@@ -68,10 +69,10 @@ SignalHandlersInit(EventLoop &loop)
sa.sa_handler = SIG_IGN;
x_sigaction(SIGPIPE, &sa);
- SignalMonitorRegister(SIGINT, HandleShutdownSignal);
- SignalMonitorRegister(SIGTERM, HandleShutdownSignal);
+ SignalMonitorRegister(SIGINT, {&loop, HandleShutdownSignal});
+ SignalMonitorRegister(SIGTERM, {&loop, HandleShutdownSignal});
- SignalMonitorRegister(SIGHUP, handle_reload_event);
+ SignalMonitorRegister(SIGHUP, {nullptr, handle_reload_event});
#endif
}