Fix background task execution.

This commit is contained in:
Jari Sundell
2026-07-03 10:53:00 +02:00
committed by GitHub
parent 23921cc97c
commit 786f1234d2
4 changed files with 53 additions and 22 deletions
+12
View File
@@ -81,6 +81,18 @@ SignalHandler::set_unblock(unsigned int signum) {
throw std::logic_error("Could not unblock signal: " + std::string(std::strerror(errno)));
}
void
SignalHandler::set_sigchild_ignore() {
struct sigaction sa;
sa.sa_handler = SIG_IGN;
sa.sa_flags = SA_NOCLDWAIT | SA_RESTART;
sigemptyset(&sa.sa_mask);
if (sigaction(SIGCHLD, &sa, NULL) == -1)
throw std::logic_error("Could not set sigaction (ignore) for SIGCHLD: " + std::string(std::strerror(errno)));
}
void
SignalHandler::set_sigaction_handler(unsigned int signum, handler_slot slot) {
if (signum >= HIGHEST_SIGNAL)