dashpay / dash

Dash - Reinventing Cryptocurrency
https://www.dash.org
MIT License
1.49k stars 1.2k forks source link

refactor: replace `LOCKS_EXCLUDED` with stricter negative `EXCLUSIVE_LOCKS_REQUIRED` in Dash-specific code #6001

Closed kwvg closed 4 months ago

kwvg commented 4 months ago

Additional Information

With the exception some usages of cs_main and a few (Recursive)Mutexes, Bitcoin has replaced their usage of LOCKS_EXCLUDED(cs) with EXCLUSIVE_LOCKS_REQUIRED(!cs) due to the stricter enforcement that negative locking brings with Clang (and it having a trickle-up effect caused by needing lock annotations on calling functions as well).

Dash intensively uses LOCKS_EXCLUDED for Dash-specific logic and moving it over also required updating (or adding) lock annotations for calling functions.

This pull request is being opened due to an upcoming pull request that includes https://github.com/bitcoin/bitcoin/pull/25109, which requires all AssertLockNotHeld usage to accompany a negative lock annotation.

Breaking Changes

None expected. (Negative) lock enforcement has been made stricter but no new locks should be introduced by changes.

Checklist: