639 | @@ -639,7 +640,8 @@ class CChainState
640 | */
641 | bool ActivateBestChain(
642 | BlockValidationState& state,
643 | - std::shared_ptr<const CBlock> pblock = nullptr) LOCKS_EXCLUDED(m_chainstate_mutex, cs_main);
644 | + std::shared_ptr<const CBlock> pblock = nullptr)
645 | + EXCLUSIVE_LOCKS_REQUIRED(!::cs_main, !m_chainstate_mutex);
Tend toward NACK using negative annotations with global mutexes, especially cs_main. I presume LOCKS_EXCLUDED(::cs_main) EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex) doesn't work?
What's wrong with using negative annotations with global mutexes? I don't see how the scope of the mutex is relevant, but maybe I miss something since @hebasto also wasn't excited about it. Can you elaborate?
I presume LOCKS_EXCLUDED(::cs_main) EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex) doesn't work?
It works. Updated the PR.
Can you elaborate?
See the commit that you ACKed: 9ac8f6d7ddc4c949d84de5584baa813144c7fb26
- It is wasted effort, since cs_main is recursive
- It is impossible to properly implement: #20272 (review)
- It is too verbose for globals, as they propagate outside the scope of "their"
class