aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <[email protected]>2016-09-09 08:15:01 +0000
committerLuke Dashjr <[email protected]>2016-11-11 11:35:49 +0000
commitfb0c934d1b2d58b165e13d2b301e54870c5dc60f (patch)
tree50e25726ca442c99754413e283ac7adca78a8413 /src/wallet/wallet.cpp
parentMerge #9115: Mention reporting security issues responsibly (diff)
downloaddiscoin-fb0c934d1b2d58b165e13d2b301e54870c5dc60f.tar.xz
discoin-fb0c934d1b2d58b165e13d2b301e54870c5dc60f.zip
Wallet: Let the interval-flushing thread figure out the filename
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index c2bac6e33..36b7ddbbc 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3549,6 +3549,8 @@ bool CWallet::InitLoadWallet()
return true;
}
+std::atomic<bool> CWallet::fFlushThreadRunning(false);
+
void CWallet::postInitProcess(boost::thread_group& threadGroup)
{
// Add wallet transactions that aren't already in a block to mempool
@@ -3556,7 +3558,9 @@ void CWallet::postInitProcess(boost::thread_group& threadGroup)
ReacceptWalletTransactions();
// Run a thread to flush wallet periodically
- threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(this->strWalletFile)));
+ if (!CWallet::fFlushThreadRunning.exchange(true)) {
+ threadGroup.create_thread(ThreadFlushWalletDB);
+ }
}
bool CWallet::ParameterInteraction()