EventLoop_t eventLoop = EventLoop_t();
-static void sigint_reboot_cb(EventLoop_t *eloop) noexcept;
-static void sigquit_cb(EventLoop_t *eloop) noexcept;
-static void sigterm_cb(EventLoop_t *eloop) noexcept;
+static void sigint_reboot_cb(EventLoop_t &eloop) noexcept;
+static void sigquit_cb(EventLoop_t &eloop) noexcept;
+static void sigterm_cb(EventLoop_t &eloop) noexcept;
static void close_control_socket() noexcept;
static void control_socket_cb(EventLoop_t *loop, int fd);
class CallbackSignalHandler : public EventLoop_t::signal_watcher_impl<CallbackSignalHandler>
{
public:
- typedef void (*cb_func_t)(EventLoop_t *);
+ typedef void (*cb_func_t)(EventLoop_t &);
private:
cb_func_t cb_func;
rearm received(EventLoop_t &eloop, int signo, siginfo_p siginfo)
{
- service_set->stop_all_services(ShutdownType::REBOOT);
+ cb_func(eloop);
return rearm::REARM;
}
};
}
/* handle SIGINT signal (generated by kernel when ctrl+alt+del pressed) */
-static void sigint_reboot_cb(EventLoop_t *eloop) noexcept
+static void sigint_reboot_cb(EventLoop_t &eloop) noexcept
{
service_set->stop_all_services(ShutdownType::REBOOT);
}
/* handle SIGQUIT (if we are system init) */
-static void sigquit_cb(EventLoop_t *eloop) noexcept
+static void sigquit_cb(EventLoop_t &eloop) noexcept
{
// This performs an immediate shutdown, without service rollback.
close_control_socket();
}
/* handle SIGTERM/SIGQUIT(non-system-daemon) - stop all services and shut down */
-static void sigterm_cb(EventLoop_t *eloop) noexcept
+static void sigterm_cb(EventLoop_t &eloop) noexcept
{
service_set->stop_all_services();
}