mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 18:53:23 -03:00
Add ChainstateManager::GetMutex(), an alias for ::cs_main
This commit is contained in:
parent
0f90b58686
commit
fa530bcb9c
1 changed files with 13 additions and 0 deletions
|
@ -868,6 +868,19 @@ public:
|
|||
const CChainParams& GetParams() const { return m_chainparams; }
|
||||
const Consensus::Params& GetConsensus() const { return m_chainparams.GetConsensus(); }
|
||||
|
||||
/**
|
||||
* Alias for ::cs_main.
|
||||
* Should be used in new code to make it easier to make ::cs_main a member
|
||||
* of this class.
|
||||
* Generally, methods of this class should be annotated to require this
|
||||
* mutex. This will make calling code more verbose, but also help to:
|
||||
* - Clarify that the method will acquire a mutex that heavily affects
|
||||
* overall performance.
|
||||
* - Force call sites to think how long they need to acquire the mutex to
|
||||
* get consistent results.
|
||||
*/
|
||||
RecursiveMutex& GetMutex() const LOCK_RETURNED(::cs_main) { return ::cs_main; }
|
||||
|
||||
std::thread m_load_block;
|
||||
//! A single BlockManager instance is shared across each constructed
|
||||
//! chainstate to avoid duplicating block metadata.
|
||||
|
|
Loading…
Add table
Reference in a new issue