Commit fa530bc MacroFake
committed
1 parent 0f90b58 commit fa530bc Copy full SHA for fa530bc
File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -868,6 +868,19 @@ class ChainstateManager
868
868
const CChainParams& GetParams () const { return m_chainparams; }
869
869
const Consensus::Params& GetConsensus () const { return m_chainparams.GetConsensus (); }
870
870
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
+
871
884
std::thread m_load_block;
872
885
// ! A single BlockManager instance is shared across each constructed
873
886
// ! chainstate to avoid duplicating block metadata.
You can’t perform that action at this time.
0 commit comments