From de7c5f41aba860751ef7824245e6d9d5088a1200 Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Thu, 30 May 2019 14:02:41 +1000 Subject: wallet/wallet.h: Remove mutexScanning which was only protecting a single atomic bool --- src/wallet/wallet.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/wallet/wallet.h') diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 8f624c25d7..a4cb8253d3 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -631,7 +631,6 @@ private: std::atomic fScanningWallet{false}; // controlled by WalletRescanReserver std::atomic m_scanning_start{0}; std::atomic m_scanning_progress{0}; - std::mutex mutexScanning; friend class WalletRescanReserver; //! the current wallet version: clients below this version are not able to load the wallet @@ -1286,13 +1285,11 @@ public: bool reserve() { assert(!m_could_reserve); - std::lock_guard lock(m_wallet.mutexScanning); - if (m_wallet.fScanningWallet) { + if (m_wallet.fScanningWallet.exchange(true)) { return false; } m_wallet.m_scanning_start = GetTimeMillis(); m_wallet.m_scanning_progress = 0; - m_wallet.fScanningWallet = true; m_could_reserve = true; return true; } @@ -1304,7 +1301,6 @@ public: ~WalletRescanReserver() { - std::lock_guard lock(m_wallet.mutexScanning); if (m_could_reserve) { m_wallet.fScanningWallet = false; } -- cgit v1.2.3