# spin::mutex - Rust
Locks that have the same behaviour as a mutex.
Keywords: rust, rustlang, rust-lang, mutex

# Module spin::mutex

source · [−]
Expand description

Locks that have the same behaviour as a mutex.

The `Mutex` in the root of the crate, can be configured using the `ticket_mutex` feature. If it’s enabled, `TicketMutex` and `TicketMutexGuard` will be re-exported as `Mutex` and `MutexGuard`, otherwise the `SpinMutex` and guard will be re-exported.

`ticket_mutex` is enabled by default.

## Structs

Mutex

A spin-based lock providing mutually exclusive access to data.

MutexGuard

A generic guard that will protect some data access and uses either a ticket lock or a normal spin mutex.

SpinMutex

A spin lock providing mutually exclusive access to data.

SpinMutexGuard

A guard that provides mutable data access.

TicketMutex

A spin-based ticket lock providing mutually exclusive access to data.

TicketMutexGuard

A guard that protects some data.