aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 9d37eb3c06..8d33878186 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -40,10 +40,13 @@ void Shutdown(void* parg)
static CCriticalSection cs_Shutdown;
static bool fTaken;
bool fFirstThread = false;
- TRY_CRITICAL_BLOCK(cs_Shutdown)
{
- fFirstThread = !fTaken;
- fTaken = true;
+ TRY_LOCK(cs_Shutdown, lockShutdown);
+ if (lockShutdown)
+ {
+ fFirstThread = !fTaken;
+ fTaken = true;
+ }
}
static bool fExit;
if (fFirstThread)