Why bitcoin use so many RecursiveMutex #32934

issue cyjseagull openend this issue on July 10, 2025
  1. cyjseagull commented at 9:38 am on July 10, 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 another issue 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?

    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. cyjseagull added the label Feature on Jul 10, 2025
  3. cyjseagull closed this on Jul 11, 2025

  4. hebasto removed the label Feature on Jul 11, 2025


cyjseagull


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: 2025-07-11 12:13 UTC

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