Why bitcoin use so many RecursiveMutex #32947

issue cyjseagull opened this issue on July 11, 2025
  1. cyjseagull commented at 11:13 AM on July 11, 2025: none

    Please describe the feature you'd like to see added.

    I have noticed that in the Bitcoin source code, almost all thread-safe sections use RecursiveGuard. As we all know, RecursiveGuard is exclusive, which can impact system performance and concurrency.

    At the same time, I have also noticed #19303 specifically tracking the replacement of RecursiveMutex with Mutex, which would help reduce some of the locking overhead.

    However, I think Mutex is still exclusive. For modules like the transaction pool, which involve both reading and writing transactions—such as querying pending transactions and inserting new ones.

    wouldn't using a read-write lock (SharedMutex) directly provide better performance? If I make this kind of modification, is it officially recommended?

    Is your feature related to a problem, if so please describe it.

    No response

    Describe the solution you'd like

    No response

    Describe any alternatives you've considered

    No response

    Please leave any additional context

    No response

  2. achow101 commented at 7:47 PM on July 11, 2025: member

    Stop opening duplicate issues.

  3. achow101 closed this on Jul 11, 2025

  4. bitcoin blocked a user on Jul 11, 2025

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-02 12:12 UTC

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