Why bitcoin use so many RecursiveMutex #32946

issue cyjseagull openend this issue on July 11, 2025
  1. cyjseagull commented at 11:07 am on July 11, 2025: none

    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?

  2. fanquake closed this 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-12 09:13 UTC

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