MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / handler_SIGTERM

Function handler_SIGTERM

imperative/python/src/utils.cpp:193–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191 "ERROR: Unexpected floating-point exception encountered in worker.\n");
192
193static 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
207static void set_worker_signal_handlers() {
208 set_signal_handler(SIGSEGV, &handler_SIGSEGV, nullptr);

Callers

nothing calls this directly

Calls 2

_exitFunction · 0.85
sigactionClass · 0.70

Tested by

no test coverage detected