mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Limit scope of all global std::once_flag
This commit is contained in:
parent
cb88de3e3d
commit
fa9c675591
@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
static RecursiveMutex cs_rpcWarmup;
|
static RecursiveMutex cs_rpcWarmup;
|
||||||
static std::atomic<bool> g_rpc_running{false};
|
static std::atomic<bool> g_rpc_running{false};
|
||||||
static std::once_flag g_rpc_interrupt_flag;
|
|
||||||
static std::once_flag g_rpc_stop_flag;
|
|
||||||
static bool fRPCInWarmup GUARDED_BY(cs_rpcWarmup) = true;
|
static bool fRPCInWarmup GUARDED_BY(cs_rpcWarmup) = true;
|
||||||
static std::string rpcWarmupStatus GUARDED_BY(cs_rpcWarmup) = "RPC server started";
|
static std::string rpcWarmupStatus GUARDED_BY(cs_rpcWarmup) = "RPC server started";
|
||||||
/* Timer-creating functions */
|
/* Timer-creating functions */
|
||||||
@ -295,6 +293,7 @@ void StartRPC()
|
|||||||
|
|
||||||
void InterruptRPC()
|
void InterruptRPC()
|
||||||
{
|
{
|
||||||
|
static std::once_flag g_rpc_interrupt_flag;
|
||||||
// This function could be called twice if the GUI has been started with -server=1.
|
// This function could be called twice if the GUI has been started with -server=1.
|
||||||
std::call_once(g_rpc_interrupt_flag, []() {
|
std::call_once(g_rpc_interrupt_flag, []() {
|
||||||
LogPrint(BCLog::RPC, "Interrupting RPC\n");
|
LogPrint(BCLog::RPC, "Interrupting RPC\n");
|
||||||
@ -305,6 +304,7 @@ void InterruptRPC()
|
|||||||
|
|
||||||
void StopRPC()
|
void StopRPC()
|
||||||
{
|
{
|
||||||
|
static std::once_flag g_rpc_stop_flag;
|
||||||
// This function could be called twice if the GUI has been started with -server=1.
|
// This function could be called twice if the GUI has been started with -server=1.
|
||||||
assert(!g_rpc_running);
|
assert(!g_rpc_running);
|
||||||
std::call_once(g_rpc_stop_flag, []() {
|
std::call_once(g_rpc_stop_flag, []() {
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
LockedPoolManager* LockedPoolManager::_instance = nullptr;
|
LockedPoolManager* LockedPoolManager::_instance = nullptr;
|
||||||
std::once_flag LockedPoolManager::init_flag;
|
|
||||||
|
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
// Utilities
|
// Utilities
|
||||||
|
@ -221,7 +221,8 @@ public:
|
|||||||
/** Return the current instance, or create it once */
|
/** Return the current instance, or create it once */
|
||||||
static LockedPoolManager& Instance()
|
static LockedPoolManager& Instance()
|
||||||
{
|
{
|
||||||
std::call_once(LockedPoolManager::init_flag, LockedPoolManager::CreateInstance);
|
static std::once_flag init_flag;
|
||||||
|
std::call_once(init_flag, LockedPoolManager::CreateInstance);
|
||||||
return *LockedPoolManager::_instance;
|
return *LockedPoolManager::_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +235,6 @@ private:
|
|||||||
static bool LockingFailed();
|
static bool LockingFailed();
|
||||||
|
|
||||||
static LockedPoolManager* _instance;
|
static LockedPoolManager* _instance;
|
||||||
static std::once_flag init_flag;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BITCOIN_SUPPORT_LOCKEDPOOL_H
|
#endif // BITCOIN_SUPPORT_LOCKEDPOOL_H
|
||||||
|
Loading…
Reference in New Issue
Block a user