| 191 | "ERROR: Unexpected floating-point exception encountered in worker.\n"); |
| 192 | |
| 193 | static void handler_SIGTERM(int sig, siginfo_t* info, void* ctx) { |
| 194 | if (info->si_pid == getppid()) { |
| 195 | _exit(EXIT_SUCCESS); |
| 196 | } |
| 197 | struct sigaction sa {}; |
| 198 | sa.sa_handler = SIG_DFL; |
| 199 | sa.sa_flags = 0; |
| 200 | if (sigemptyset(&sa.sa_mask) != 0 || sigaction(SIGTERM, &sa, nullptr) != 0) { |
| 201 | _exit(EXIT_FAILURE); |
| 202 | } else { |
| 203 | raise(SIGTERM); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | static void set_worker_signal_handlers() { |
| 208 | set_signal_handler(SIGSEGV, &handler_SIGSEGV, nullptr); |