Skip to content
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

backport: remove boost from sync.h/.cpp #3520

Open
wants to merge 9 commits into
base: 1.15.0-dev
Choose a base branch
from

Conversation

xanimo
Copy link
Member

@xanimo xanimo commented Apr 17, 2024

Consolidation of multiple cherry-picks with regards to sync.h and sync.cpp.

TheBlueMatt and others added 9 commits April 16, 2024 14:42
…o std from boost.

Commit 1.

This code was written by @TheBlueMatt in the following branch:
* https://github.com/TheBlueMatt/bitcoin/commits/2017-08-test-10923

This commit message was written by me (@practicalswift) who also squashed
@TheBlueMatt's commits into one and tried to summarize the changes made.

Commit 2.

Remove boost include. Remove boost mentions in comments.

Cherry-picked from: 7e319d6
Move AnnotatedMixin closer to where it's used, and after the DEBUG_LOCKORDER
function declarations so it can call them.

Cherry-picked from: ba1f095
They should also work with any other mutex type which std::unique_lock
supports.

There is no change in behavior for current code that calls these macros with
CCriticalSection mutexes.

Cherry-picked from: 1382913
Instead of std::unique_lock.

Cherry-picked from: 9c4dc59
Call sync.h primitives "locks" and "mutexes" instead of "blocks" and "waitable
critical sections" to match current coding conventions and c++11 standard
names.

This PR does not rename the "CCriticalSection" class (though this could be done
as a followup) because it is used everywhere and would swamp the other changes
in this PR. Plain mutexes should mostly be preferred instead of recursive
mutexes in new code anyway.

-BEGIN VERIFY SCRIPT-
set -x
set -e
ren() { git grep -l $1 | xargs sed -i s/$1/$2/; }
ren CCriticalBlock           UniqueLock
ren CWaitableCriticalSection Mutex
ren CConditionVariable       std::condition_variable
ren cs_GenesisWait           g_genesis_wait_mutex
ren condvar_GenesisWait      g_genesis_wait_cv
perl -0777 -pi -e 's/.*typedef.*condition_variable.*\n\n?//g' src/sync.h
-END VERIFY SCRIPT-

Cherry-picked from: 190bf62
@xanimo xanimo changed the title sync: remove boost from sync sync: remove boost Apr 17, 2024
@xanimo xanimo changed the title sync: remove boost backport: remove boost from sync.h/.cpp Apr 17, 2024
@patricklodder
Copy link
Member

I think this is a (partial) duplicate of #3313?

@xanimo
Copy link
Member Author

xanimo commented Apr 17, 2024

I think this is a (partial) duplicate of #3313?

It appears so. My apologies. I will rework this tomorrow.

@patricklodder
Copy link
Member

I will rework this tomorrow.

Perhaps I can just backport the unit test from here into there, and unblock #3313 that way? Then you can focus on the RNG stuff and not bother with this one. 😊

@xanimo
Copy link
Member Author

xanimo commented Apr 17, 2024

I will rework this tomorrow.

Perhaps I can just backport the unit test from here into there, and unblock #3313 that way? Then you can focus on the RNG stuff and not bother with this one. 😊

Sounds good to me. About to catch some 💤 Will address anything further en la manana. ❤️✌️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants