Page MenuHomePhabricator

refactor: replace RecursiveMutex m_most_recent_block_mutex with Mutex

Authored by PiRK on Nov 30 2023, 10:22.



refactor: reduce scope of lock m_most_recent_block_mutex

This avoids calling the non-trivial method
CConnman::PushMessage within the critical section.

refactor: replace RecursiveMutex m_most_recent_block_mutex with Mutex

In each of the critical sections, only the the guarded variables are
accessed, without any chance that within one section another one is
called. Hence, we can use an ordinary Mutex instead of RecursiveMutex.

This is a backport of core#24062

Depends on D14878

Test Plan
ninja all check-all

Diff Detail

rABC Bitcoin ABC
Lint Not Applicable
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Nov 30 2023, 10:22
Fabien added inline comments.
6994 ↗(On Diff #43329)

This change is unrelated to the mutex being non recursive right ? AFAICT there is no lock removal in this change

6994 ↗(On Diff #43329)

The goal is to reduce the scope of the lock by moving PushMessage out of the scope of the lock, but I don't think it was strictly necessary, I don't see how PushMessage could take that lock.
The rationale is just that PushMessage is "non-trivial"

This revision is now accepted and ready to land.Dec 1 2023, 09:08