Cargo Features

spin = { version = "0.9.8", default-features = false, features = ["mutex", "spin_mutex", "ticket_mutex", "fair_mutex", "use_ticket_mutex", "rwlock", "once", "lazy", "barrier", "lock_api", "std", "portable_atomic"] }
default = barrier, lazy, lock_api, mutex, once, rwlock, spin_mutex

These default features are set whenever spin is added without default-features = false somewhere in the dependency tree.

mutex default barrier fair_mutex? spin_mutex ticket_mutex? use_ticket_mutex?

Enables Mutex. Must be used with either spin_mutex or use_ticket_mutex.

Affects spin::mutex, spin::Mutex, spin::lock_api.Mutex, spin::lock_api.MutexGuard

spin_mutex default = mutex

Enables SpinMutex and the default spin mutex implementation for Mutex.

Affects mutex::spin

ticket_mutex use_ticket_mutex? = mutex

Enables TicketMutex.

Affects mutex::ticket

fair_mutex = mutex

Enables FairMutex.

Affects mutex::fair

use_ticket_mutex = mutex, ticket_mutex

Enables the non-default ticket mutex implementation for Mutex.

rwlock default

Enables RwLock.

Affects spin::rwlock, spin::RwLock, spin::RwLockUpgradableGuard, spin::RwLockWriteGuard, spin::lock_api.RwLock, spin::lock_api.RwLockReadGuard, spin::lock_api.RwLockWriteGuard, spin::lock_api.RwLockUpgradableReadGuard

once default lazy

Enables Once.

Affects spin::once, spin::Once

lazy default = once

Enables Lazy.

Affects spin::lazy, spin::Lazy

barrier default = mutex

Enables Barrier. Because this feature uses mutex, either spin_mutex or use_ticket_mutex must be enabled.

Affects spin::barrier, spin::Barrier

lock_api default = lock_api_crate

Enables lock_api-compatible types that use the primitives in this crate internally.

Affects spin::lock_api


Enables std-only features such as yield-relaxing.

Affects relax::Yield

portable_atomic = portable-atomic

Use the portable_atomic crate to support platforms without native atomic operations. The portable_atomic_unsafe_assume_single_core cfg or critical-section feature of portable-atomic crate must also be set by the final binary crate. When using the cfg, note that it is unsafe and enabling it for multicore systems is unsound. When using the critical-section feature, you need to implement the critical-section implementation that sound for your system by implementing an unsafe trait. See the documentation for the portable-atomic crate for more information:

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features.

lock_api_crate lock_api

Enables lock_api

portable-atomic portable_atomic?