Avoid locking CTxMemPool::cs recursively in simple cases #19854

pull hebasto wants to merge 6 commits into bitcoin:master from hebasto:200901-mmx3 changing 2 files +16 −13
  1. hebasto commented at 9:49 AM on September 1, 2020: member

    This is another step to transit CTxMemPool::cs from RecursiveMutex to Mutex.

    Split out from #19306. Only trivial thread safety annotations and lock assertions added. No new locks. No behavior change.

    Refactoring const uint256 to const uint256& was requested by promag.

    Please note that now, since #19668 has been merged, it is safe to apply AssertLockHeld() macros as they do not swallow compile time Thread Safety Analysis warnings.

  2. refactor: CTxMemPool::UpdateParent() requires CTxMemPool::cs lock
    No change in behavior, the lock is already held at call sites.
    939807768a
  3. refactor: CTxMemPool::UpdateChild() requires CTxMemPool::cs lock
    No change in behavior, the lock is already held at call sites.
    66e47e5e50
  4. refactor: CTxMemPool::ApplyDelta() requires CTxMemPool::cs lock
    No change in behavior, the lock is already held at call sites.
    Also `const uint256` refactored to `const uint256&`.
    7140b31b90
  5. refactor: CTxMemPool::ClearPrioritisation() requires CTxMemPool::cs lock
    No change in behavior, the lock is already held at call sites.
    Also `const uint256` refactored to `const uint256&`.
    fa5fcb032b
  6. refactor: CTxMemPool::GetTotalTxSize() requires CTxMemPool::cs lock
    No change in behavior, the lock is already held at call sites.
    7c4bd0387a
  7. refactor: CTxMemPool::IsUnbroadcastTx() requires CTxMemPool::cs lock
    No change in behavior, the lock is already held at call sites.
    020f0519ec
  8. hebasto cross-referenced this on Sep 1, 2020 from issue Add thread safety annotations to CTxMemPool methods by hebasto
  9. fanquake added the label Refactoring on Sep 1, 2020
  10. fanquake added the label Mempool on Sep 1, 2020
  11. hebasto cross-referenced this on Sep 1, 2020 from issue Replace all of the RecursiveMutex instances with the Mutex ones by hebasto
  12. ajtowns commented at 10:53 AM on September 1, 2020: contributor

    Concept ACK, looks reasonable

  13. DrahtBot commented at 12:26 PM on September 1, 2020: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #19478 (Remove CTxMempool::mapLinks data structure member by JeremyRubin)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  14. DrahtBot cross-referenced this on Sep 1, 2020 from issue Remove CTxMempool::mapLinks data structure member by JeremyRubin
  15. vasild approved
  16. vasild commented at 9:11 AM on September 2, 2020: contributor

    ACK 020f0519e

  17. promag commented at 11:49 AM on September 2, 2020: member

    Core review ACK 020f0519ec66d9626255b938e1c6c3f7f9aa4017.

  18. hebasto cross-referenced this on Sep 4, 2020 from issue scripted-diff: Restore AssertLockHeld after #19668, remove LockAssertion by ryanofsky
  19. jnewbery commented at 10:07 AM on September 4, 2020: member

    Code review ACK 020f0519ec66d9626255b938e1c6c3f7f9aa4017

  20. laanwj merged this on Sep 4, 2020
  21. laanwj closed this on Sep 4, 2020

  22. hebasto deleted the branch on Sep 4, 2020
  23. hebasto cross-referenced this on Sep 4, 2020 from issue Avoid locking CTxMemPool::cs recursively in some cases by hebasto
  24. hebasto cross-referenced this on Sep 6, 2020 from issue Avoid locking CTxMemPool::cs recursively in CTxMemPool::DynamicMemoryUsage() by hebasto
  25. sidhujag referenced this in commit 45b8840fd3 on Sep 9, 2020
  26. Fabcien referenced this in commit ee5de8785e on Sep 22, 2021
  27. bitcoin 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: 2026-05-20 06:54 UTC