Skip to content

Conversation

@tjps
Copy link
Contributor

@tjps tjps commented Nov 18, 2017

Replaced boost threading primitives with the std equivalents.

@sipa
Copy link
Member

sipa commented Nov 18, 2017

This uses thread_local, a feature that we chose to not use before, though I don't remember why. Perhaps because we needed compatibility with GCC 4.7? Is that still the case, @laanwj @theuni

@laanwj
Copy link
Member

laanwj commented Nov 19, 2017

This uses thread_local, a feature that we chose to not use before, though I don't remember why.

Given that it's only used when lock debugging is used I'd say it's acceptable.

Also FWIW I tried to build bitcoin on g++ 4.7 a while ago and it was a pain; for example the AX_CXX_COMPILE_STDCXX fails because the __cplusplus macro is not set correctly, and that's only the beginning. As it's already effectively broken and no one else seems to even notice it, I wouldn't mind bumping the requirement to g++ 4.8 wholesale. But I'm not sure that discussion belongs here.

@laanwj laanwj requested a review from theuni November 19, 2017 10:33
Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.


#include <sync.h>

#include <set>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazingly enough the #include tree in sync.cpp did not pull in std::set already.

@practicalswift
Copy link
Contributor

Concept ACK

@tjps
Copy link
Contributor Author

tjps commented Nov 27, 2017

Since #11732 was resolved in favor of bumping GCC requirement to 4.8, looks like this PR is good to go?

@sipa
Copy link
Member

sipa commented Nov 27, 2017

utACK bba9bd0

Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thread_local was also off-limits due to missing support in osx's clang. It's been added as of XCode 8 on September 13, 2016. I'm uneasy with that as a minimum requirement.

Additionally, last time I checked this, the use of thread_local causes new symbols to be pulled in from glibc on Linux, meaning that we would lose back-compat with older versions. I'd have to re-test to see where the break lies.

That said, I think it's ok to lessen the requirement for the DEBUG_LOCKCONTENTION case, as long as there's a comment there mentioning that it's problematic for other code.

As osx is probably not the only platform where this will cause headaches, I'd also prefer to add an autoconf link test for thread_local.

@TheBlueMatt
Copy link
Contributor

utACK bba9bd0 modulo thread_local concerns. I also think its probably OK in DEBUG_LOCKCONTENTION only even if its not on all supported platforms.

@theuni
Copy link
Member

theuni commented Nov 27, 2017

Pushed up a commit on top of this PR that adds the configure check for thread_local: theuni@d6df116 . I've verified that it works as intended for me in Linux, and breaks as intended on osx.

@tjps assuming that works for you, mind cherry-picking it here?

@tjps
Copy link
Contributor Author

tjps commented Nov 27, 2017

That looks great to me, will cherry-pick it onto this PR.

Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! utACK f7f7e2c.

@laanwj laanwj merged commit f7f7e2c into bitcoin:master Nov 28, 2017
laanwj added a commit that referenced this pull request Nov 28, 2017
f7f7e2c threads: add a thread_local autoconf check (Cory Fields)
bba9bd0 Switched sync.{cpp,h} to std threading primitives. (Thomas Snider)

Pull request description:

  Replaced boost threading primitives with the std equivalents.

Tree-SHA512: 72d10f9e48bfcf1db87e4a88bc698ef98eba0b29fe904570391b34a6ea1ffad474b7f192e70e3588a30e448f70f244eb4ddc5f24412a0bde2b564e76274160a5
@tjps tjps deleted the tjps_sync_antiboost branch December 18, 2017 20:23
jamesob added a commit to jamesob/bitcoin that referenced this pull request Jun 4, 2018
jamesob added a commit to jamesob/bitcoin that referenced this pull request Jun 13, 2018
jamesob added a commit to jamesob/bitcoin that referenced this pull request Jun 13, 2018
jamesob added a commit to jamesob/bitcoin that referenced this pull request Jun 14, 2018
jamesob added a commit to jamesob/bitcoin that referenced this pull request Jun 15, 2018
jamesob added a commit to jamesob/bitcoin that referenced this pull request Jun 20, 2018
jamesob added a commit to jamesob/bitcoin that referenced this pull request Jul 11, 2018
jamesob added a commit to jamesob/bitcoin that referenced this pull request Aug 20, 2018
jamesob added a commit to jamesob/bitcoin that referenced this pull request Jan 17, 2019
jamesob added a commit to jamesob/bitcoin that referenced this pull request Apr 18, 2019
jamesob added a commit to jamesob/bitcoin that referenced this pull request Apr 26, 2019
Note that this doesn't affect anything unless
DEBUG_LOCKCONTENTION is defined.

See discussions here:

- bitcoin#11722 (review)
- bitcoin#13168 (comment)
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 1, 2019
Note that this doesn't affect anything unless
DEBUG_LOCKCONTENTION is defined.

See discussions here:

- bitcoin#11722 (review)
- bitcoin#13168 (comment)
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Aug 30, 2019
Note that this doesn't affect anything unless
DEBUG_LOCKCONTENTION is defined.

See discussions here:

- bitcoin#11722 (review)
- bitcoin#13168 (comment)
barrystyle pushed a commit to zentoshi/zentoshi that referenced this pull request Nov 11, 2019
Note that this doesn't affect anything unless
DEBUG_LOCKCONTENTION is defined.

See discussions here:

- bitcoin/bitcoin#11722 (review)
- bitcoin/bitcoin#13168 (comment)
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Mar 24, 2020
f7f7e2c threads: add a thread_local autoconf check (Cory Fields)
bba9bd0 Switched sync.{cpp,h} to std threading primitives. (Thomas Snider)

Pull request description:

  Replaced boost threading primitives with the std equivalents.

Tree-SHA512: 72d10f9e48bfcf1db87e4a88bc698ef98eba0b29fe904570391b34a6ea1ffad474b7f192e70e3588a30e448f70f244eb4ddc5f24412a0bde2b564e76274160a5
@str4d str4d mentioned this pull request Apr 12, 2021
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Jun 28, 2021
f7f7e2c threads: add a thread_local autoconf check (Cory Fields)
bba9bd0 Switched sync.{cpp,h} to std threading primitives. (Thomas Snider)

Pull request description:

  Replaced boost threading primitives with the std equivalents.

Tree-SHA512: 72d10f9e48bfcf1db87e4a88bc698ef98eba0b29fe904570391b34a6ea1ffad474b7f192e70e3588a30e448f70f244eb4ddc5f24412a0bde2b564e76274160a5
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants