mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
4cd32e43e4
1fabd59e7 Break circular dependency: init -> * -> init by extracting shutdown.h (Ben Woosley) e62fdfeea Drop unused init.h includes (Ben Woosley) Pull request description: Most includers just wanted to react to pending shutdown. This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `CancelShutdown` for setting it to `false`. Tree-SHA512: df42f75dfbba163576710e9a67cf1228531fd99d70a2f187bfba0bcc476d6749cf88180a97e66a81bb5b6c3c7f0917de7402d26039ba7b644cb7509b02f7e267
33 lines
675 B
C++
33 lines
675 B
C++
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-2018 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <shutdown.h>
|
|
|
|
#include <atomic>
|
|
|
|
static std::atomic<bool> fRequestShutdown(false);
|
|
static std::atomic<bool> fRequestRestart(false);
|
|
|
|
void StartShutdown()
|
|
{
|
|
fRequestShutdown = true;
|
|
}
|
|
void StartRestart()
|
|
{
|
|
fRequestShutdown = fRequestRestart = true;
|
|
}
|
|
void AbortShutdown()
|
|
{
|
|
fRequestShutdown = false;
|
|
}
|
|
bool ShutdownRequested()
|
|
{
|
|
return fRequestShutdown;
|
|
}
|
|
bool RestartRequested()
|
|
{
|
|
return fRequestRestart;
|
|
}
|