Skip to content

document reentrancy of std::sync::Mutex. #32260

Closed
@matklad

Description

@matklad

std::sync::Mutex is not reentrant (you can't .lock a mutex if you already .locked it and haven't released the lock), but this behavior is not documented.

Looks like the exact consequences of locking the mutex twice vary by platform. On linux, you get a deadlock. On windows there is a panic: https://github.com/rust-lang/rust/blob/master/src/libstd/sys/windows/mutex.rs#L75. Maybe this should panic on all platforms?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions