Improve thread safety annotation coverage #19838

issue hebasto openend this issue on August 30, 2020
  1. hebasto commented at 10:07 am on August 30, 2020: member

    Clang Thread Safety Analysis (TSA) is a C++ language extension which warns about potential race conditions in code.

    To improve our code base it is desirable to review all cases of Mutex (non-recursive) class/struct member mutexes, add TSA annotations to method declarations (including negative ones), and add corresponding lock assertions to method definitions.

    Useful skills:

    Clang compiler experience, basic understanding of Thread Safety Analysis.

    Want to work on this issue?

    For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.

  2. hebasto commented at 2:13 pm on September 1, 2020: member
    @MarcoFalke @fanquake Mind labeling this issue?
  3. dongcarl added the label good first issue on Sep 1, 2020
  4. hebasto renamed this:
    Good first issue: Improve thread safety annotation coverage
    Improve thread safety annotation coverage
    on Sep 2, 2020
  5. n1rna commented at 2:43 pm on September 9, 2020: contributor

    I would like to take this issue as I think the required knowledge is not much far away from my level to grasp on.

    For better understanding the desired changes, I have a few questions.

    • I searched ^\s*Mutex\s*\w*; on all files and found roughly 21 places where a Mutex is defined. Are these all the mutexes used throughout the code base? (You mentioned only non-recursive Mutexes)
    • Should I review usage of each of these Mutexes and add annotations like ACQUIRE or RELEASE to declaration of methods that are utilizing a Mutex?
    • Last question is regarding WAIT_LOCK, does this indicate the lock is being released?
  6. hebasto commented at 10:41 am on September 10, 2020: member

    As currently some discussions about proper lock assertions get started (#19865, #19918, #19929), going to close this issue for now. @n1rna

    • Last question is regarding WAIT_LOCK, does this indicate the lock is being released?

    Yes, when the lock goes out of scope.

  7. hebasto closed this on Sep 10, 2020

  8. DrahtBot locked this on Feb 15, 2022

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: 2024-09-29 01:12 UTC

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