summaryrefslogtreecommitdiff
path: root/src/unix/SignalHandlers.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-02-16 20:38:56 +0100
committerMax Kellermann <max@musicpd.org>2020-02-17 15:23:05 +0100
commitd1cc73775fe96a3c42108a01aad00056060df564 (patch)
tree967412fa7dd03809c0581fb05de77d28fa82f398 /src/unix/SignalHandlers.cxx
parent29d05cdb8ecde61ba04cbd8c67c11dd4e76abd53 (diff)
Instance: flush input cache on SIGHUP
Diffstat (limited to 'src/unix/SignalHandlers.cxx')
-rw-r--r--src/unix/SignalHandlers.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/unix/SignalHandlers.cxx b/src/unix/SignalHandlers.cxx
index 873025ec0..5dbb47778 100644
--- a/src/unix/SignalHandlers.cxx
+++ b/src/unix/SignalHandlers.cxx
@@ -47,10 +47,14 @@ x_sigaction(int signum, const struct sigaction *act)
}
static void
-handle_reload_event(void *) noexcept
+handle_reload_event(void *ctx) noexcept
{
- LogDebug(signal_handlers_domain, "got SIGHUP, reopening log files");
+ auto &instance = *(Instance *)ctx;
+
+ LogDebug(signal_handlers_domain, "got SIGHUP, reopening log files and flushing caches");
cycle_log_files();
+
+ instance.FlushCaches();
}
#endif
@@ -73,7 +77,7 @@ SignalHandlersInit(Instance &instance)
SignalMonitorRegister(SIGINT, {&loop, HandleShutdownSignal});
SignalMonitorRegister(SIGTERM, {&loop, HandleShutdownSignal});
- SignalMonitorRegister(SIGHUP, {nullptr, handle_reload_event});
+ SignalMonitorRegister(SIGHUP, {&instance, handle_reload_event});
#endif
}