Skip to content

Replace std::mutex with DefaultUnnamedMutex to avoid named mutex exhaustion#950

Open
rgomez391 wants to merge 3 commits intomainfrom
user/raulalbertog/porting-mutex-changes
Open

Replace std::mutex with DefaultUnnamedMutex to avoid named mutex exhaustion#950
rgomez391 wants to merge 3 commits intomainfrom
user/raulalbertog/porting-mutex-changes

Conversation

@rgomez391
Copy link
Contributor

@rgomez391 rgomez391 commented Mar 20, 2026

This pull request introduces a custom mutex class, DefaultUnnamedMutex, to work around a platform STL defect where std::mutex default construction creates named mutexes — which have a low system-wide limit. The new class ensures mutexes are unnamed by default, preventing handle exhaustion under heavy concurrency. All std::mutex usages are replaced with DefaultUnnamedMutex throughout the codebase.

STL mutex workaround:

General codebase update for thread safety:

  • Ensured that all lock guards and atomic operations now use DefaultUnnamedMutex for consistent behavior across platforms. [1] [2]

Header and dependency updates:

@rgomez391 rgomez391 changed the title Replace std::mutex with DefaultUnnamedMutex to avoid named mutex exhaustion Replace std::mutex with Mutex to avoid named mutex exhaustion Mar 20, 2026
@rgomez391 rgomez391 requested a review from jasonsandlin March 20, 2026 23:15
@rgomez391 rgomez391 changed the title Replace std::mutex with Mutex to avoid named mutex exhaustion Replace std::mutex with DefaultUnnamedMutex to avoid named mutex exhaustion Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants