UPD 2023-04-18. See a shortlist here.
This is a tracking issue for the long-term goal to replace all of the RecursiveMutex
instances with the Mutex
ones throughout the code base.
Anthony Williams (C++ Concurrency in Action, 2019, 3.3.3 Recursive locking):
Most of the time, if you think you want a recursive mutex, you probably need to change your design instead.
Anthony Towns, #19303 (comment):
… the actual goal is “make locking logic easier to follow” rather than “remove RecurviseMutex”
Should be noted, to insure that mutex locking policy has not been changed by accident in non-trivial cases, all of the related code branches must be covered by appropriate lock assertions: AssertLockHeld()
or AssertLockNotHeld()
.
Also Clang Thread Safety Analysis annotations with Negative Capabilities are very useful (see #19249) but are not a panacea, of course :)
-
RecursiveMutex cs_Shutdown
(#19180) -
RecursiveMutex cs_nTimeOffset
(#19189) -
RecursiveMutex cs_proxyInfos
(#19190) - ~
RecursiveMutex csPathCached
(#19213)~ -
RecursiveMutex cs_warnings
(#19220) -
RecursiveMutex CAddrMan::cs
(#19238) -
RecursiveMutex BanMan::m_cs_banned
(#24092, #24097) -
RecursiveMutex cs_mapLocalHost
(#24099) -
RecursiveMutex CConnman::cs_totalBytesRecv
(#22829) -
RecursiveMutex CConnman::cs_totalBytesSent
(#24157) -
RecursiveMutex CConnman::m_addr_fetches_mutex
(#22829) -
RecursiveMutex CConnman::cs_vAddedNodes
(#22829) -
RecursiveMutex CConnman::m_nodes_mutex
-
RecursiveMutex CNode::cs_vSend
(#19915) -
RecursiveMutex CNode::cs_hSocket
(#19915) -
RecursiveMutex CNode::cs_vRecv
(#19915) - ~
RecursiveMutex CNode::cs_vProcessMsg
(#24122)~ - ~
RecursiveMutex CNode::cs_sendProcessing
(#25597)~ -
RecursiveMutex CNode::cs_SubVer
(#24079) -
RecursiveMutex CNode::cs_inventory
(#19347) -
RecursiveMutex CNode::cs_addrName
(removed in #22782) -
RecursiveMutex CNode::cs_addrLocal
#24108 -
RecursiveMutex Peer::TxRelay::m_bloom_filter_mutex
-
RecursiveMutex Peer::TxRelay::m_tx_inventory_mutex
(#24125) -
RecursiveMutex CNode::TxRelay::cs_feeFilter
(#18819) - ~
RecursiveMutex g_cs_orphans
~ -
RecursiveMutex g_cs_recent_confirmed_transactions
(#19378) -
RecursiveMutex cs_most_recent_block
(#24062) -
RecursiveMutex CBlockPolicyEstimator::m_cs_fee_estimator
(#22014) -
RecursiveMutex cs_rpcWarmup
(#19399) -
RecursiveMutex SingleThreadedSchedulerClient::m_cs_callbacks_pending
(#24069) -
RecursiveMutex BlockManager::cs_LastBlockFile
-
RecursiveMutex FillableSigningProvider::cs_KeyStore
-
RecursiveMutex ArgsManager::cs_args
-
RecursiveMutex CChainState::cs_nBlockSequenceId
(#22824) -
RecursiveMutex CChainState::m_cs_chainstate
(#24103) -
RecursiveMutex cs_db
-
RecursiveMutex DescriptorScriptPubKeyMan::cs_desc_man
-
RecursiveMutex cs_wallets
(#19101) -
RecursiveMutex CWallet::cs_wallet
(#19773, #19833)
and