Q: cs_main protection for referencing m_blockman/g_chainman? #20325

issue dongcarl opened this issue on November 5, 2020
  1. dongcarl commented at 9:54 PM on November 5, 2020: member

    While making my de-globalize ChainstateManager changes, I noticed something that I wasn't sure what to make of: both the global instance of ChainstateManager g_chainman and the BlockManager member of g_chainman are protected by ::cs_main.

    This means that changes like the following where I'm simply passing a BlockManager to a function have to add an awkward WITH_LOCK in order to appease thread safety analysis.

    Examples:

    1. d227dfe (#20158)
    2. f8e91ed (#20158)

    However, I'm not entirely sure if these ::cs_main protections should be required for referencing these objects themselves, especially since ChainstateManager and BlockManagers's member variables/functions are already well annotated w/re locks.

    Any insights would be useful :-)

  2. dongcarl added the label Questions and Help on Nov 5, 2020
  3. dongcarl renamed this:
    Q: cs_main protection for m_blockman/g_chainman reference
    Q: cs_main protection for referencing m_blockman/g_chainman?
    on Nov 5, 2020
  4. MarcoFalke commented at 4:15 PM on January 13, 2022: member

    Is this still an issue?

  5. dongcarl commented at 5:32 PM on January 13, 2022: member

    Nope!

    For context see: #24024

  6. dongcarl closed this on Jan 13, 2022

  7. DrahtBot locked this on Jan 13, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-26 06:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me