aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-06-05 21:55:17 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-06-05 22:04:57 +0300
commit1a9ef1d398dd14728b6bc67a89139cdf827c9753 (patch)
treec22186426028b890701c659f894590d3c480559c /src
parent0fc6ea216c00fff470bd876c53418afca63bf7e9 (diff)
downloadbitcoin-1a9ef1d398dd14728b6bc67a89139cdf827c9753.tar.xz
refactor: Replace RecursiveMutex with Mutex in Shutdown()
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/init.cpp b/src/init.cpp
index b48c26cd3e..133b4d5d86 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -18,6 +18,7 @@
#include <compat/sanity.h>
#include <consensus/validation.h>
#include <fs.h>
+#include <hash.h>
#include <httprpc.h>
#include <httpserver.h>
#include <index/blockfilterindex.h>
@@ -42,6 +43,7 @@
#include <script/sigcache.h>
#include <script/standard.h>
#include <shutdown.h>
+#include <sync.h>
#include <timedata.h>
#include <torcontrol.h>
#include <txdb.h>
@@ -53,8 +55,6 @@
#include <util/threadnames.h>
#include <util/translation.h>
#include <validation.h>
-#include <hash.h>
-
#include <validationinterface.h>
#include <walletinitinterface.h>
@@ -171,11 +171,10 @@ void Interrupt(NodeContext& node)
void Shutdown(NodeContext& node)
{
+ static Mutex g_shutdown_mutex;
+ TRY_LOCK(g_shutdown_mutex, lock_shutdown);
+ if (!lock_shutdown) return;
LogPrintf("%s: In progress...\n", __func__);
- static RecursiveMutex cs_Shutdown;
- TRY_LOCK(cs_Shutdown, lockShutdown);
- if (!lockShutdown)
- return;
/// Note: Shutdown() must be able to handle cases in which initialization failed part of the way,
/// for example if the data directory was found to be locked.