-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Remove unused boost/thread #18758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unused boost/thread #18758
Conversation
faef463 to
fa8122c
Compare
|
Concept ACK. |
|
Concept ACK |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
fad6f40af271bd6094a70fea8311e5d0d18e7ae7 how about bitcoin/src/wallet/walletdb.cpp Lines 782 to 784 in eef90c1
|
|
Concept ACK. |
fae70ac to
1123846
Compare
|
Concept ACK. Not thread related, but could throw in: diff --git a/src/init.cpp b/src/init.cpp
index 37e625129..438dc3762 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -71,9 +71,7 @@
#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>to remove some more Boost includes. |
The same cleanup is done in 46838e9 from #18710. Mind reviewing it? |
1123846 to
830c07e
Compare
830c07e to
89f9fef
Compare
|
Rebased and cherry-picked one commit by @hebasto |
hebasto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 89f9fef, tested on Linux Mint 19.3 (x86_64), verified shutdown in different scenarios.
fanquake
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 89f9fef
fad8c89: Checked that the calls to CCoinsViewDB::Upgrade and CBlockTreeDB::LoadBlockIndexGuts only happen in the [init] thread. As mentioned both of these calls were followed by a ShutdownRequested() anyways.
faa958b: Checked that txindex is run in a std::thread.
Lines 311 to 313 in 01b45b2
| m_thread_sync = std::thread(&TraceThread<std::function<void()>>, GetName(), | |
| std::bind(&BaseIndex::ThreadSync, this)); |
Also followed by a call to ShutdownRequested().
|
🥳 Thanks everyone for the reviews on this set! Now all boost thread interruption points are removed:
|
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
Summary: > txindex: Remove unused boost/thread > txdb: Remove unused boost/thread > refactor: Specify boost/thread/thread.hpp explicitly > 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) To make it work for our codebase, I had to add an addition include in system.cpp and core_io_tests.cpp. This is a backport of [[bitcoin/bitcoin#18758 | core#18758]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, majcosta, deadalnix Reviewed By: #bitcoin_abc, majcosta, deadalnix Subscribers: majcosta Differential Revision: https://reviews.bitcoinabc.org/D9522
There are predefined interruption points for
boost::thread: https://www.boost.org/doc/libs/1_71_0/doc/html/thread/thread_management.html#interruption_pointsHowever, non-boost threads such as
std::threador themain()thread can obviously not be interrupted. So remove all unused boost/thread from methods that are never executed in aboost::thread.Most of them were accompanied by a
ShutdownRequestedanyway. So even if the current thread was aboost::thread, the interruption point would be redundant. (We only interrupt threads during shutdown)