mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Merge #18758: Remove unused boost/thread
89f9fef1f7refactor: Specify boost/thread/thread.hpp explicitly (Hennadii Stepanov)fad8c890f5txdb: Remove unused boost/thread (MarcoFalke)faa958bc28txindex: 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: ACK89f9fef1f7hebasto: ACK89f9fef1f7, tested on Linux Mint 19.3 (x86_64), verified shutdown in different scenarios. Tree-SHA512: 17221dadedf2d107e5bda9e4f371cc4f8ffce6ad27cae41aa2b8f1150d8f1adf23d396585ca4a2dd25b1dc6f0d5c81fecd950d8557966ccb45a6d4a85a331d90
This commit is contained in:
@@ -9,8 +9,6 @@
|
|||||||
#include <util/translation.h>
|
#include <util/translation.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
|
||||||
#include <boost/thread.hpp>
|
|
||||||
|
|
||||||
constexpr char DB_BEST_BLOCK = 'B';
|
constexpr char DB_BEST_BLOCK = 'B';
|
||||||
constexpr char DB_TXINDEX = 't';
|
constexpr char DB_TXINDEX = 't';
|
||||||
constexpr char DB_TXINDEX_BLOCK = 'T';
|
constexpr char DB_TXINDEX_BLOCK = 'T';
|
||||||
@@ -150,7 +148,6 @@ bool TxIndex::DB::MigrateData(CBlockTreeDB& block_tree_db, const CBlockLocator&
|
|||||||
bool interrupted = false;
|
bool interrupted = false;
|
||||||
std::unique_ptr<CDBIterator> cursor(block_tree_db.NewIterator());
|
std::unique_ptr<CDBIterator> cursor(block_tree_db.NewIterator());
|
||||||
for (cursor->Seek(begin_key); cursor->Valid(); cursor->Next()) {
|
for (cursor->Seek(begin_key); cursor->Valid(); cursor->Next()) {
|
||||||
boost::this_thread::interruption_point();
|
|
||||||
if (ShutdownRequested()) {
|
if (ShutdownRequested()) {
|
||||||
interrupted = true;
|
interrupted = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -71,11 +71,9 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/algorithm/string/split.hpp>
|
|
||||||
#include <boost/signals2/signal.hpp>
|
#include <boost/signals2/signal.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
|
|
||||||
#if ENABLE_ZMQ
|
#if ENABLE_ZMQ
|
||||||
#include <zmq/zmqabstractnotifier.h>
|
#include <zmq/zmqabstractnotifier.h>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
|
|
||||||
#include <cuckoocache.h>
|
#include <cuckoocache.h>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread/shared_mutex.hpp>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <util/time.h>
|
#include <util/time.h>
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <util/time.h>
|
#include <util/time.h>
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include <type_traits>
|
#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 */
|
/** 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;
|
extern const std::function<void(const std::string&)> G_TEST_LOG_FUN;
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <boost/thread.hpp>
|
|
||||||
|
|
||||||
static const char DB_COIN = 'C';
|
static const char DB_COIN = 'C';
|
||||||
static const char DB_COINS = 'c';
|
static const char DB_COINS = 'c';
|
||||||
static const char DB_BLOCK_FILES = 'f';
|
static const char DB_BLOCK_FILES = 'f';
|
||||||
@@ -242,7 +240,6 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams,
|
|||||||
|
|
||||||
// Load m_block_index
|
// Load m_block_index
|
||||||
while (pcursor->Valid()) {
|
while (pcursor->Valid()) {
|
||||||
boost::this_thread::interruption_point();
|
|
||||||
if (ShutdownRequested()) return false;
|
if (ShutdownRequested()) return false;
|
||||||
std::pair<char, uint256> key;
|
std::pair<char, uint256> key;
|
||||||
if (pcursor->GetKey(key) && key.first == DB_BLOCK_INDEX) {
|
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> key;
|
||||||
std::pair<unsigned char, uint256> prev_key = {DB_COINS, uint256()};
|
std::pair<unsigned char, uint256> prev_key = {DB_COINS, uint256()};
|
||||||
while (pcursor->Valid()) {
|
while (pcursor->Valid()) {
|
||||||
boost::this_thread::interruption_point();
|
|
||||||
if (ShutdownRequested()) {
|
if (ShutdownRequested()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ EXPECTED_BOOST_INCLUDES=(
|
|||||||
boost/signals2/last_value.hpp
|
boost/signals2/last_value.hpp
|
||||||
boost/signals2/signal.hpp
|
boost/signals2/signal.hpp
|
||||||
boost/test/unit_test.hpp
|
boost/test/unit_test.hpp
|
||||||
boost/thread.hpp
|
|
||||||
boost/thread/condition_variable.hpp
|
boost/thread/condition_variable.hpp
|
||||||
boost/thread/mutex.hpp
|
boost/thread/mutex.hpp
|
||||||
|
boost/thread/shared_mutex.hpp
|
||||||
boost/thread/thread.hpp
|
boost/thread/thread.hpp
|
||||||
boost/variant.hpp
|
boost/variant.hpp
|
||||||
boost/variant/apply_visitor.hpp
|
boost/variant/apply_visitor.hpp
|
||||||
|
|||||||
Reference in New Issue
Block a user