diff options
| author | Pieter Wuille <[email protected]> | 2012-04-09 13:25:17 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2012-04-09 13:25:17 -0700 |
| commit | 1a275bac2b5454ae9d6744f28c29cbf40e2fbf13 (patch) | |
| tree | 4cf7a1b4001ef82c15f4942f6a495aaf530c7d0e /src/init.cpp | |
| parent | Merge branch 'filesystem' of https://github.com/Diapolo/bitcoin (diff) | |
| parent | Do not report spurious deadlocks caused by TRY_LOCK (diff) | |
| download | discoin-1a275bac2b5454ae9d6744f28c29cbf40e2fbf13.tar.xz discoin-1a275bac2b5454ae9d6744f28c29cbf40e2fbf13.zip | |
Merge pull request #1052 from sipa/scopedlocks
Use scoped locks instead of CRITICAL_BLOCK
Diffstat (limited to 'src/init.cpp')
| -rw-r--r-- | src/init.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/init.cpp b/src/init.cpp index 3f900fc87..a1e45b1c6 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) |