MCPcopy Create free account
hub / github.com/ElementsProject/elements / StartShutdown

Function StartShutdown

src/shutdown.cpp:56–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56void StartShutdown()
57{
58#ifdef WIN32
59 std::unique_lock<std::mutex> lk(g_shutdown_mutex);
60 fRequestShutdown = true;
61 g_shutdown_cv.notify_one();
62#else
63 // This must be reentrant and safe for calling in a signal handler, so using a condition variable is not safe.
64 // Make sure that the token is only written once even if multiple threads call this concurrently or in
65 // case of a reentrant signal.
66 if (!fRequestShutdown.exchange(true)) {
67 // Write an arbitrary byte to the write end of the shutdown pipe.
68 int res = g_shutdown_w.TokenWrite('x');
69 if (res != 0) {
70 LogPrintf("Sending shutdown token failed\n");
71 assert(0);
72 }
73 }
74#endif
75}
76
77void AbortShutdown()
78{

Callers 9

AbortNodeFunction · 0.85
HandleSIGTERMFunction · 0.85
consoleCtrlHandlerFunction · 0.85
ActivateBestChainMethod · 0.85
nativeEventFilterMethod · 0.85
FatalErrorFunction · 0.85
stopFunction · 0.85
ThreadImportFunction · 0.85
startShutdownMethod · 0.85

Calls 1

TokenWriteMethod · 0.80

Tested by

no test coverage detected