MCPcopy Create free account
hub / github.com/NetSys/bess / CatchExitSignal

Function CatchExitSignal

core/utils/syscallthread.cc:68–83  ·  view source on GitHub ↗

* Establishes the exit signal masks and handlers. */

Source from the content-addressed store, hash-verified

66 * Establishes the exit signal masks and handlers.
67 */
68bool CatchExitSignal() {
69 if (!ProcessMasks.initialized) {
70 struct sigaction sa;
71 memset(&sa, 0, sizeof(sa));
72 sa.sa_handler = ExitRequestHandler;
73 if (sigaction(SIG_THREAD_EXIT, &sa, NULL) < 0) {
74 return false;
75 }
76 sigfillset(&ProcessMasks.allmask); // complete blockage of everything
77 sigfillset(&ProcessMasks.mostmask); // block all except SIG_THREAD_EXIT
78 sigdelset(&ProcessMasks.mostmask, SIG_THREAD_EXIT);
79
80 ProcessMasks.initialized = true;
81 }
82 return true;
83}
84
85// pthread_sigmask shouldn't return EINTR, but we can check.
86static inline void PthreadSetSigmask(const sigset_t *mask) {

Callers 1

StartMethod · 0.85

Calls 1

sigactionClass · 0.70

Tested by

no test coverage detected