13 #include <condition_variable> 23 std::mutex g_shutdown_mutex;
24 std::condition_variable g_shutdown_cv;
53 std::unique_lock<std::mutex> lk(g_shutdown_mutex);
55 g_shutdown_cv.notify_one();
62 const char token =
'x';
96 std::unique_lock<std::mutex> lk(g_shutdown_mutex);
bool ShutdownRequested()
Returns true if a shutdown is requested, false otherwise.
static int g_shutdown_pipe[2]
On UNIX-like operating systems use the self-pipe trick.
bool InitShutdownState()
Initialize shutdown state.
static std::atomic< bool > fRequestShutdown(false)
void WaitForShutdown()
Wait for StartShutdown to be called in any thread.
void AbortShutdown()
Clear shutdown flag.
void StartShutdown()
Request shutdown of the application.