Switched sync.{cpp,h} to std threading primitives. #11722
pull tjps wants to merge 2 commits into bitcoin:master from tjps:tjps_sync_antiboost changing 4 files +40 −19-
tjps commented at 7:38 pm on November 18, 2017: contributorReplaced boost threading primitives with the std equivalents.
-
Switched sync.{cpp,h} to std threading primitives. bba9bd0d9d
-
fanquake added the label Refactoring on Nov 18, 2017
-
fanquake added this to the "In progress" column in a project
-
laanwj commented at 10:17 am on November 19, 2017: member
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 requested review from theuni on Nov 19, 2017
-
in src/sync.cpp:7 in bba9bd0d9d outdated
3@@ -4,13 +4,12 @@ 4 5 #include <sync.h> 6 7+#include <set>
promag commented at 12:42 pm on November 19, 2017:Why?
tjps commented at 5:28 pm on November 19, 2017:Amazingly enough the #include tree in sync.cpp did not pull in std::set already.promag commented at 12:43 pm on November 19, 2017: memberConcept ACK.practicalswift commented at 1:02 pm on November 20, 2017: contributorConcept ACKsipa commented at 10:35 am on November 27, 2017: memberutACK bba9bd0d9dd06f13a6b0c89181864453cab5c858theuni commented at 9:43 pm on November 27, 2017: memberthread_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 commented at 9:54 pm on November 27, 2017: memberutACK bba9bd0d9dd06f13a6b0c89181864453cab5c858 modulo thread_local concerns. I also think its probably OK in DEBUG_LOCKCONTENTION only even if its not on all supported platforms.theuni commented at 10:14 pm on November 27, 2017: memberPushed up a commit on top of this PR that adds the configure check for thread_local: https://github.com/theuni/bitcoin/commit/d6df1162d3cba1aabae4f5ae61da6a81881ea118 . 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 commented at 10:30 pm on November 27, 2017: contributorThat looks great to me, will cherry-pick it onto this PR.threads: add a thread_local autoconf check f7f7e2cd34theuni approvedtheuni commented at 0:22 am on November 28, 2017: memberThanks! utACK f7f7e2cd340c088e82d09090eb275b98b34a9812.laanwj merged this on Nov 28, 2017laanwj closed this on Nov 28, 2017
laanwj referenced this in commit 26efc220a1 on Nov 28, 2017fanquake moved this from the "In progress" to the "Done" column in a project
tjps deleted the branch on Dec 18, 2017jamesob referenced this in commit 2ed61a42f2 on May 21, 2018jamesob referenced this in commit 3e1de02c25 on Jun 4, 2018jamesob referenced this in commit 789758c500 on Jun 13, 2018jamesob referenced this in commit b4c026b739 on Jun 13, 2018jamesob referenced this in commit cdada4f684 on Jun 14, 2018jamesob referenced this in commit bf2cb44e5b on Jun 14, 2018jamesob referenced this in commit 4c21846ec3 on Jun 14, 2018jamesob referenced this in commit 696bdb7510 on Jun 15, 2018jamesob referenced this in commit 6f854f68bc on Jun 20, 2018jamesob referenced this in commit 99d6a1e865 on Jul 11, 2018jamesob referenced this in commit 558f3235ee on Aug 20, 2018jamesob referenced this in commit 315d84314a on Jan 17, 2019jamesob referenced this in commit 7550fc1bcc on Apr 18, 2019jamesob referenced this in commit c1d159999c on Apr 18, 2019jamesob referenced this in commit 188ca75e5f on Apr 26, 2019sidhujag referenced this in commit 500e70c86d on May 1, 2019HashUnlimited referenced this in commit ddcb2ca45d on Aug 30, 2019barrystyle referenced this in commit e98602b60d on Nov 11, 2019PastaPastaPasta referenced this in commit 605c9c02eb on Feb 27, 2020PastaPastaPasta referenced this in commit 3d67b17dd2 on Mar 14, 2020PastaPastaPasta referenced this in commit e6a7b6a93d on Mar 14, 2020PastaPastaPasta referenced this in commit 6c7d1e4dd0 on Mar 19, 2020PastaPastaPasta referenced this in commit 1e41cf9f3d on Mar 24, 2020ckti referenced this in commit 0c3807fba4 on Mar 28, 2021gades referenced this in commit 5f6adc1fb6 on Jun 28, 2021DrahtBot locked this on Sep 8, 2021
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-19 00:12 UTC
More mirrored repositories can be found on mirror.b10c.me