refactor: use std::shared_mutex & remove Boost Thread#21064
Merged
laanwj merged 4 commits intobitcoin:masterfrom Feb 12, 2021
Merged
refactor: use std::shared_mutex & remove Boost Thread#21064laanwj merged 4 commits intobitcoin:masterfrom
laanwj merged 4 commits intobitcoin:masterfrom
Conversation
…ache tests Co-authored-by: MarcoFalke [email protected] Co-authored-by: sinetek [email protected]
Co-authored-by: MarcoFalke [email protected] Co-authored-by: sinetek [email protected]
Adjust fuzzbuzz.yml to only install the Boost components we need.
Member
|
Concept ACK. |
Member
|
Code review ACK 060a2a6 |
Contributor
|
Concept ACK |
Contributor
|
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. |
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Feb 12, 2021
This was referenced Sep 9, 2021
kwvg
added a commit
to kwvg/dash
that referenced
this pull request
Sep 15, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This replaces
boost::shared_mutexandboost::unique_lockwithstd::shared_mutex&std::unique_lock.Even though some concerns were raised in #16684 with regard to
std::shared_mutexbeing unsafe to use across some glibc versions, I still think this change is an improvement. As I mentioned in #21022, I also think trying to restrict standard library feature usage based on bugs in glibc is not only hard to do, but it's not currently clear exactly how we do that in practice (does it also extend to patching out use in our dependencies, should we be implementing more runtime checks for features we are using, when do we consider an affected glibc "old enough" not to worry about? etc). If you take a look through the glibc bug tracker you'll no doubt find plenty of (active) bug reports for standard library code we already using. Obviously not to say we shouldn't try and avoid buggy code where possible.Two other points:
Cory mentioned in #21022:
Moving away from Boost to the standard library also removes the potential for differences related to Boosts configuration. Boost has multiple versions of
shared_mutex, and what you end up using, and what it's backed by depends on:BOOST_THREAD_VERSIONis defined: (2,3,4 or 5) default=2. (see here for some of the differences).BOOST_THREAD_V2_SHARED_MUTEXdefined? (not by default). If so, you might get the "less performant, but more robust" version ofshared_mutex.A lot of these factors are eliminated by our use of depends, but users will have varying configurations. It's also not inconceivable to think that a distro, or some package manager might start defining something like
BOOST_THREAD_VERSION=3. Boost tried to change the default from 2 to 3 at one point.With this change, we no longer use Boost Thread, so this PR also removes it from depends, the build system, CI etc.
Previous similar PRs were #19183 & #20922. The authors are included in the commits here.
Also related to #21022 - pthread sanity checking.