aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2020-06-05 10:12:59 +0800
committerfanquake <fanquake@gmail.com>2020-06-05 11:01:39 +0800
commit4ede05d421e7799e631bb83ed16799e8bae79eeb (patch)
treed5db7a1cdad94234b8a05231ffc0f248cbd6c5bc /src
parent01b45b2e016f0b0907929e818216edf7157fb03a (diff)
parent89f9fef1f71dfeff4baa59bc42bc9049a46d911b (diff)
downloadbitcoin-4ede05d421e7799e631bb83ed16799e8bae79eeb.tar.xz
Merge #18758: Remove unused boost/thread
89f9fef1f71dfeff4baa59bc42bc9049a46d911b refactor: Specify boost/thread/thread.hpp explicitly (Hennadii Stepanov) fad8c890f5ae6e083e416781b4857a1a53ad5249 txdb: Remove unused boost/thread (MarcoFalke) faa958bc283023334b9377f5fb2210459ca16d82 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 89f9fef1f71dfeff4baa59bc42bc9049a46d911b hebasto: ACK 89f9fef1f71dfeff4baa59bc42bc9049a46d911b, tested on Linux Mint 19.3 (x86_64), verified shutdown in different scenarios. Tree-SHA512: 17221dadedf2d107e5bda9e4f371cc4f8ffce6ad27cae41aa2b8f1150d8f1adf23d396585ca4a2dd25b1dc6f0d5c81fecd950d8557966ccb45a6d4a85a331d90
Diffstat (limited to 'src')
-rw-r--r--src/index/txindex.cpp3
-rw-r--r--src/init.cpp4
-rw-r--r--src/script/sigcache.cpp2
-rw-r--r--src/test/checkqueue_tests.cpp2
-rw-r--r--src/test/scheduler_tests.cpp2
-rw-r--r--src/test/util/setup_common.h2
-rw-r--r--src/txdb.cpp4
7 files changed, 5 insertions, 14 deletions
diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp
index 4626395ef0..59d1888fff 100644
--- a/src/index/txindex.cpp
+++ b/src/index/txindex.cpp
@@ -9,8 +9,6 @@
#include <util/translation.h>
#include <validation.h>
-#include <boost/thread.hpp>
-
constexpr char DB_BEST_BLOCK = 'B';
constexpr char DB_TXINDEX = 't';
constexpr char DB_TXINDEX_BLOCK = 'T';
@@ -150,7 +148,6 @@ bool TxIndex::DB::MigrateData(CBlockTreeDB& block_tree_db, const CBlockLocator&
bool interrupted = false;
std::unique_ptr<CDBIterator> cursor(block_tree_db.NewIterator());
for (cursor->Seek(begin_key); cursor->Valid(); cursor->Next()) {
- boost::this_thread::interruption_point();
if (ShutdownRequested()) {
interrupted = true;
break;
diff --git a/src/init.cpp b/src/init.cpp
index 0ff89eb816..b48c26cd3e 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -71,11 +71,9 @@
#include <sys/stat.h>
#endif
-#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/replace.hpp>
-#include <boost/algorithm/string/split.hpp>
#include <boost/signals2/signal.hpp>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
#if ENABLE_ZMQ
#include <zmq/zmqabstractnotifier.h>
diff --git a/src/script/sigcache.cpp b/src/script/sigcache.cpp
index 3c54d5bee4..aaecab1ef2 100644
--- a/src/script/sigcache.cpp
+++ b/src/script/sigcache.cpp
@@ -11,7 +11,7 @@
#include <util/system.h>
#include <cuckoocache.h>
-#include <boost/thread.hpp>
+#include <boost/thread/shared_mutex.hpp>
namespace {
/**
diff --git a/src/test/checkqueue_tests.cpp b/src/test/checkqueue_tests.cpp
index 35750b2ebc..8348810ac1 100644
--- a/src/test/checkqueue_tests.cpp
+++ b/src/test/checkqueue_tests.cpp
@@ -10,7 +10,7 @@
#include <util/time.h>
#include <boost/test/unit_test.hpp>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
#include <atomic>
#include <condition_variable>
diff --git a/src/test/scheduler_tests.cpp b/src/test/scheduler_tests.cpp
index 1395a7f38c..fcee6a9b9d 100644
--- a/src/test/scheduler_tests.cpp
+++ b/src/test/scheduler_tests.cpp
@@ -7,7 +7,7 @@
#include <util/time.h>
#include <boost/test/unit_test.hpp>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
#include <mutex>
diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h
index 2477f9ad06..d5cda8a95b 100644
--- a/src/test/util/setup_common.h
+++ b/src/test/util/setup_common.h
@@ -17,7 +17,7 @@
#include <type_traits>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
/** This is connected to the logger. Can be used to redirect logs to any other log */
extern const std::function<void(const std::string&)> G_TEST_LOG_FUN;
diff --git a/src/txdb.cpp b/src/txdb.cpp
index 129697f0e7..6f652c1375 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -16,8 +16,6 @@
#include <stdint.h>
-#include <boost/thread.hpp>
-
static const char DB_COIN = 'C';
static const char DB_COINS = 'c';
static const char DB_BLOCK_FILES = 'f';
@@ -242,7 +240,6 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams,
// Load m_block_index
while (pcursor->Valid()) {
- boost::this_thread::interruption_point();
if (ShutdownRequested()) return false;
std::pair<char, uint256> key;
if (pcursor->GetKey(key) && key.first == DB_BLOCK_INDEX) {
@@ -354,7 +351,6 @@ bool CCoinsViewDB::Upgrade() {
std::pair<unsigned char, uint256> key;
std::pair<unsigned char, uint256> prev_key = {DB_COINS, uint256()};
while (pcursor->Valid()) {
- boost::this_thread::interruption_point();
if (ShutdownRequested()) {
break;
}