Skip to content

Replace all of the RecursiveMutex instances with the Mutex ones #19303

@hebasto

Description

@hebasto

UPD 2023-04-18. See a shortlist here.


This is a tracking issue for the long-term goal to replace all of the RecursiveMutex instances with the Mutex ones throughout the code base.

Anthony Williams (C++ Concurrency in Action, 2019, 3.3.3 Recursive locking):

Most of the time, if you think you want a recursive mutex, you probably need to change your design instead.

Anthony Towns, #19303 (comment):

... the actual goal is "make locking logic easier to follow" rather than "remove RecurviseMutex"

Should be noted, to insure that mutex locking policy has not been changed by accident in non-trivial cases, all of the related code branches must be covered by appropriate lock assertions: AssertLockHeld() or AssertLockNotHeld().

Also Clang Thread Safety Analysis annotations with Negative Capabilities are very useful (see #19249) but are not a panacea, of course :)


and

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions