Skip to content

Commit 4ede05d

Browse files
committed
Merge #18758: Remove unused boost/thread
89f9fef refactor: Specify boost/thread/thread.hpp explicitly (Hennadii Stepanov) fad8c89 txdb: Remove unused boost/thread (MarcoFalke) faa958b txindex: Remove unused boost/thread (MarcoFalke) Pull request description: There are predefined interruption points for `boost::thread`: https://www.boost.org/doc/libs/1_71_0/doc/html/thread/thread_management.html#interruption_points However, non-boost threads such as `std::thread` or the `main()` thread can obviously not be interrupted. So remove all unused boost/thread from methods that are never executed in a `boost::thread`. Most of them were accompanied by a `ShutdownRequested` anyway. So even if the current thread was a `boost::thread`, the interruption point would be redundant. (We only interrupt threads during shutdown) ACKs for top commit: fanquake: ACK 89f9fef hebasto: ACK 89f9fef, tested on Linux Mint 19.3 (x86_64), verified shutdown in different scenarios. Tree-SHA512: 17221dadedf2d107e5bda9e4f371cc4f8ffce6ad27cae41aa2b8f1150d8f1adf23d396585ca4a2dd25b1dc6f0d5c81fecd950d8557966ccb45a6d4a85a331d90
2 parents 01b45b2 + 89f9fef commit 4ede05d

File tree

8 files changed

+6
-15
lines changed

8 files changed

+6
-15
lines changed

src/index/txindex.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include <util/translation.h>
1010
#include <validation.h>
1111

12-
#include <boost/thread.hpp>
13-
1412
constexpr char DB_BEST_BLOCK = 'B';
1513
constexpr char DB_TXINDEX = 't';
1614
constexpr char DB_TXINDEX_BLOCK = 'T';
@@ -150,7 +148,6 @@ bool TxIndex::DB::MigrateData(CBlockTreeDB& block_tree_db, const CBlockLocator&
150148
bool interrupted = false;
151149
std::unique_ptr<CDBIterator> cursor(block_tree_db.NewIterator());
152150
for (cursor->Seek(begin_key); cursor->Valid(); cursor->Next()) {
153-
boost::this_thread::interruption_point();
154151
if (ShutdownRequested()) {
155152
interrupted = true;
156153
break;

src/init.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,9 @@
7171
#include <sys/stat.h>
7272
#endif
7373

74-
#include <boost/algorithm/string/classification.hpp>
7574
#include <boost/algorithm/string/replace.hpp>
76-
#include <boost/algorithm/string/split.hpp>
7775
#include <boost/signals2/signal.hpp>
78-
#include <boost/thread.hpp>
76+
#include <boost/thread/thread.hpp>
7977

8078
#if ENABLE_ZMQ
8179
#include <zmq/zmqabstractnotifier.h>

src/script/sigcache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <util/system.h>
1212

1313
#include <cuckoocache.h>
14-
#include <boost/thread.hpp>
14+
#include <boost/thread/shared_mutex.hpp>
1515

1616
namespace {
1717
/**

src/test/checkqueue_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <util/time.h>
1111

1212
#include <boost/test/unit_test.hpp>
13-
#include <boost/thread.hpp>
13+
#include <boost/thread/thread.hpp>
1414

1515
#include <atomic>
1616
#include <condition_variable>

src/test/scheduler_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <util/time.h>
88

99
#include <boost/test/unit_test.hpp>
10-
#include <boost/thread.hpp>
10+
#include <boost/thread/thread.hpp>
1111

1212
#include <mutex>
1313

src/test/util/setup_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#include <type_traits>
1919

20-
#include <boost/thread.hpp>
20+
#include <boost/thread/thread.hpp>
2121

2222
/** This is connected to the logger. Can be used to redirect logs to any other log */
2323
extern const std::function<void(const std::string&)> G_TEST_LOG_FUN;

src/txdb.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
#include <stdint.h>
1818

19-
#include <boost/thread.hpp>
20-
2119
static const char DB_COIN = 'C';
2220
static const char DB_COINS = 'c';
2321
static const char DB_BLOCK_FILES = 'f';
@@ -242,7 +240,6 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams,
242240

243241
// Load m_block_index
244242
while (pcursor->Valid()) {
245-
boost::this_thread::interruption_point();
246243
if (ShutdownRequested()) return false;
247244
std::pair<char, uint256> key;
248245
if (pcursor->GetKey(key) && key.first == DB_BLOCK_INDEX) {
@@ -354,7 +351,6 @@ bool CCoinsViewDB::Upgrade() {
354351
std::pair<unsigned char, uint256> key;
355352
std::pair<unsigned char, uint256> prev_key = {DB_COINS, uint256()};
356353
while (pcursor->Valid()) {
357-
boost::this_thread::interruption_point();
358354
if (ShutdownRequested()) {
359355
break;
360356
}

test/lint/lint-includes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ EXPECTED_BOOST_INCLUDES=(
6767
boost/signals2/last_value.hpp
6868
boost/signals2/signal.hpp
6969
boost/test/unit_test.hpp
70-
boost/thread.hpp
7170
boost/thread/condition_variable.hpp
7271
boost/thread/mutex.hpp
72+
boost/thread/shared_mutex.hpp
7373
boost/thread/thread.hpp
7474
boost/variant.hpp
7575
boost/variant/apply_visitor.hpp

0 commit comments

Comments
 (0)