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

Function set_signal_handler

imperative/python/src/utils.cpp:172–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170 }
171
172static inline void set_signal_handler(
173 int signal, void (*handler)(int, siginfo_t*, void*),
174 struct sigaction* old_sa_ptr) {
175 struct sigaction sa {};
176 sa.sa_sigaction = handler;
177 sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_NOCLDSTOP | SA_NODEFER;
178 if (sigemptyset(&sa.sa_mask) != 0 || sigaction(signal, &sa, old_sa_ptr) != 0) {
179 std::ostringstream oss;
180 oss << "An error occurred while setting handler for " << strsignal(signal)
181 << ".";
182 throw std::runtime_error(oss.str());
183 }
184}
185
186SIGNAL_HANDLER(
187 SIGSEGV, handler_SIGSEGV,

Callers 1

Calls 2

sigactionClass · 0.70
strMethod · 0.45

Tested by

no test coverage detected