MCPcopy Create free account
hub / github.com/BVLC/caffe / UnhookHandler

Function UnhookHandler

src/caffe/util/signal_handler.cpp:48–67  ·  view source on GitHub ↗

Set the signal handlers to the default.

Source from the content-addressed store, hash-verified

46
47 // Set the signal handlers to the default.
48 void UnhookHandler() {
49 if (already_hooked_up) {
50 struct sigaction sa;
51 // Setup the sighub handler
52 sa.sa_handler = SIG_DFL;
53 // Restart the system call, if at all possible
54 sa.sa_flags = SA_RESTART;
55 // Block every signal during the handler
56 sigfillset(&sa.sa_mask);
57 // Intercept SIGHUP and SIGINT
58 if (sigaction(SIGHUP, &sa, NULL) == -1) {
59 LOG(FATAL) << "Cannot uninstall SIGHUP handler.";
60 }
61 if (sigaction(SIGINT, &sa, NULL) == -1) {
62 LOG(FATAL) << "Cannot uninstall SIGINT handler.";
63 }
64
65 already_hooked_up = false;
66 }
67 }
68
69 // Return true iff a SIGINT has been received since the last time this
70 // function was called.

Callers 1

~SignalHandlerMethod · 0.85

Calls 1

sigactionClass · 0.85

Tested by

no test coverage detected