Skip to content

Commit 5879bfa

Browse files
committed
Merge #18792: wallet: Remove boost from PeriodicFlush
fa1c74f wallet: Remove unused boost::thread_interrupted (MarcoFalke) fa7b885 walletdb: Remove unsed boost/thread (MarcoFalke) 5555d97 wallet: Make PeriodicFlush uninterruptible (MarcoFalke) Pull request description: The `boost::this_thread::interruption_point()` in the code base currently block the replacement of `boost::thread` with `std::thread`. [1] Remove them from the wallet because they are either unused or useless. The feature to interrupt a periodic flush is useless because all wallets have just been flushed https://github.com/bitcoin/bitcoin/blob/9ccaee1d5e2e4b79b0a7c29aadb41b97e4741332/src/init.cpp#L194 and another flush should be a noop. Also, they will be flushed again shortly after https://github.com/bitcoin/bitcoin/blob/9ccaee1d5e2e4b79b0a7c29aadb41b97e4741332/src/init.cpp#L285, so even if repeated flushes weren't a noop, doing 3 instead of 2 shouldn't matter too much at this point. Also, the wallet is flushed every two seconds in the worst case, so if this is an expensive operation, that period should be readjusted. (Or bdb should be removed altogether #18916) [1] Replacement of `boost::thread` with `std::thread` should happen because: * The boost thread dependency is slow to compile * Boost thread is less maintained than the standard lib * Boost thread is mostly redundant to the standard lib * Global interruption points via exceptions are hard to keep track of during review and easy to get wrong during runtime (e.g. accidental `catch (...)`) ACKs for top commit: fanquake: ACK fa1c74f Tree-SHA512: b166619256de2ef4325480fa1367f68bc9371ad785ec503aed61eab41ba61f1a9807aab25451a24efda3db64855c9ba0025645b98bc58557bc3ec56c5b3297d0
2 parents 9e8bd21 + fa1c74f commit 5879bfa

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/wallet/db.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include <sys/stat.h>
1515
#endif
1616

17-
#include <boost/thread.hpp>
18-
1917
namespace {
2018

2119
//! Make sure database has a unique fileid within the environment. If it
@@ -671,7 +669,6 @@ bool BerkeleyBatch::PeriodicFlush(BerkeleyDatabase& database)
671669

672670
if (nRefCount == 0)
673671
{
674-
boost::this_thread::interruption_point();
675672
std::map<std::string, int>::iterator mi = env->mapFileUseCount.find(strFile);
676673
if (mi != env->mapFileUseCount.end())
677674
{

src/wallet/walletdb.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include <atomic>
1919
#include <string>
2020

21-
#include <boost/thread.hpp>
22-
2321
namespace DBKeys {
2422
const std::string ACENTRY{"acentry"};
2523
const std::string ACTIVEEXTERNALSPK{"activeexternalspk"};
@@ -745,11 +743,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
745743
pwallet->WalletLogPrintf("%s\n", strErr);
746744
}
747745
pcursor->close();
748-
}
749-
catch (const boost::thread_interrupted&) {
750-
throw;
751-
}
752-
catch (...) {
746+
} catch (...) {
753747
result = DBErrors::CORRUPT;
754748
}
755749

@@ -887,11 +881,7 @@ DBErrors WalletBatch::FindWalletTx(std::vector<uint256>& vTxHash, std::list<CWal
887881
}
888882
}
889883
pcursor->close();
890-
}
891-
catch (const boost::thread_interrupted&) {
892-
throw;
893-
}
894-
catch (...) {
884+
} catch (...) {
895885
result = DBErrors::CORRUPT;
896886
}
897887

0 commit comments

Comments
 (0)