Replace RecursiveMutex cs_addrLocal with Mutex, and rename it#24108
Merged
maflcko merged 3 commits intobitcoin:masterfrom Jan 24, 2022
Merged
Replace RecursiveMutex cs_addrLocal with Mutex, and rename it#24108maflcko merged 3 commits intobitcoin:masterfrom
cs_addrLocal with Mutex, and rename it#24108maflcko merged 3 commits intobitcoin:masterfrom
Conversation
-BEGIN VERIFY SCRIPT- sed -i 's/cs_addrLocal/m_addr_local_mutex/g' -- $(git grep --files-with-matches 'cs_addrLocal') -END VERIFY SCRIPT-
shaavan
approved these changes
Jan 20, 2022
Contributor
shaavan
left a comment
There was a problem hiding this comment.
ACK 63ca568f484a6b36b9485165c4932938f0602b36
- The new name of cs_addrLocal -> m_addr_local_mutex is an improvement.
- I checked that
m_addr_local_mutexis being used at two places in the codebase. These instances have been addressed by Asserting Lock not held before locking the mutex. So I think it's safe to convertm_addr_local_mutexfrom RecursiveMutex to Mutex.
hebasto
reviewed
Jan 20, 2022
Member
There was a problem hiding this comment.
Concept ACK.
Adding AssertLockNotHeld(m_addr_local_mutex) macros should be combined with adding thread safety annotations LOCKS_EXCLUDED(m_addr_local_mutex) in the src/net.h. See https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#threads-and-synchronization
Also, for the safe commit history, "refactor: replace RecursiveMutex m_addr_local_mutex with Mutex" commit should follow "p2p: add assertions for m_addr_local_mutex" one.
63ca568 to
dec787d
Compare
shaavan
approved these changes
Jan 21, 2022
Contributor
shaavan
left a comment
There was a problem hiding this comment.
reACK dec787d
Changes since my last review:
- Added Thread Safety annotation,
LOCKS_EXCLUDED(m_addr_local_mutex), to theGet/Set AddrLocal()functions' declaration. - Rearranged commits so that
m_addr_local_mutexis converted to Mutex, after, other conditions are made right for it.
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Jan 28, 2022
…, and rename it dec787d refactor: replace RecursiveMutex `m_addr_local_mutex` with Mutex (w0xlt) 93609c1 p2p: add assertions and negative TS annotations for m_addr_local_mutex (w0xlt) c4a31ca scripted-diff: rename cs_addrLocal -> m_addr_local_mutex (w0xlt) Pull request description: This PR is related to bitcoin#19303 and gets rid of the `RecursiveMutex cs_addrLocal`. ACKs for top commit: hebasto: ACK dec787d, I have reviewed the code and it looks OK, I agree it can be merged. shaavan: reACK dec787d Tree-SHA512: b7a043bfd4e2ccbe313bff21ad815169db6ad215ca96daf358ce960c496a548b4a9e90be9e4357430ca59652b96df87c097450118996c6d4703cbaabde2072d0
35 tasks
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 PR is related to #19303 and gets rid of the
RecursiveMutex cs_addrLocal.