File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -868,6 +868,19 @@ class ChainstateManager
868868 const CChainParams& GetParams () const { return m_chainparams; }
869869 const Consensus::Params& GetConsensus () const { return m_chainparams.GetConsensus (); }
870870
871+ /* *
872+ * Alias for ::cs_main.
873+ * Should be used in new code to make it easier to make ::cs_main a member
874+ * of this class.
875+ * Generally, methods of this class should be annotated to require this
876+ * mutex. This will make calling code more verbose, but also help to:
877+ * - Clarify that the method will acquire a mutex that heavily affects
878+ * overall performance.
879+ * - Force call sites to think how long they need to acquire the mutex to
880+ * get consistent results.
881+ */
882+ RecursiveMutex& GetMutex () const LOCK_RETURNED(::cs_main) { return ::cs_main; }
883+
871884 std::thread m_load_block;
872885 // ! A single BlockManager instance is shared across each constructed
873886 // ! chainstate to avoid duplicating block metadata.
You can’t perform that action at this time.
0 commit comments