aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-03-07 11:00:46 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-03-07 11:00:55 +0100
commit779f2f97478ccb437c4e33d218944a6e161b55d8 (patch)
tree35400d5ecb1aff17fae0253cc58cb9f6e3a920f5 /src/wallet/wallet.cpp
parent309bf16257b2395ce502017be627186b749ee749 (diff)
parent0235be1e7aa84ceb2c882c33fc279d4593e14968 (diff)
downloadbitcoin-779f2f97478ccb437c4e33d218944a6e161b55d8.tar.xz
Merge #9605: Use CScheduler for wallet flushing, remove ThreadFlushWalletDB
0235be1 Rename FlushWalletDB -> CompactWalletDB, add function description (Matt Corallo) 735d9b5 Use CScheduler for wallet flushing, remove ThreadFlushWalletDB (Matt Corallo) 73296f5 CScheduler boost->std::function, use millisecs for times, not secs (Matt Corallo) Tree-SHA512: c04f97beab65706c444c126be229d02887df9b0972d8fb15ca1f779ef0e628cf7ecef2bf533c650d9b44645b63e01de22f17266a05907e778938d64cc6e19de6
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 02af1bf10f..04d5ea6eff 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -20,6 +20,7 @@
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sign.h"
+#include "scheduler.h"
#include "timedata.h"
#include "txmempool.h"
#include "util.h"
@@ -3754,17 +3755,17 @@ bool CWallet::InitLoadWallet()
return true;
}
-std::atomic<bool> CWallet::fFlushThreadRunning(false);
+std::atomic<bool> CWallet::fFlushScheduled(false);
-void CWallet::postInitProcess(boost::thread_group& threadGroup)
+void CWallet::postInitProcess(CScheduler& scheduler)
{
// Add wallet transactions that aren't already in a block to mempool
// Do this here as mempool requires genesis block to be loaded
ReacceptWalletTransactions();
// Run a thread to flush wallet periodically
- if (!CWallet::fFlushThreadRunning.exchange(true)) {
- threadGroup.create_thread(ThreadFlushWalletDB);
+ if (!CWallet::fFlushScheduled.exchange(true)) {
+ scheduler.scheduleEvery(MaybeCompactWalletDB, 500);
}
}