[][src]Crate spin

This crate provides spin-based versions of the primitives in std::sync and std::lazy. Because synchronization is done through spinning, the primitives are suitable for use in no_std environments.

Features

Relationship with std::sync

While spin is not a drop-in replacement for std::sync (and should not be considered as such) an effort is made to keep this crate reasonably consistent with std::sync.

Many of the types defined in this crate have 'additional capabilities' when compared to std::sync:

Conversely, the types in this crate do not have some of the features std::sync has:

Feature flags

The crate comes with a few feature flags that you may wish to use.

Re-exports

pub use mutex::MutexGuard;
pub use rwlock::RwLockReadGuard;
pub use relax::Spin;
pub use relax::RelaxStrategy;

Modules

barrier

Synchronization primitive allowing multiple threads to synchronize the beginning of some computation.

lazy

Synchronization primitives for lazy evaluation.

lock_api

Spin synchronisation primitives, but compatible with lock_api.

mutex

Locks that have the same behaviour as a mutex.

once

Synchronization primitives for one-time evaluation.

relax

Strategies that determine the behaviour of locks when encountering contention.

rwlock

A lock that provides data access to either one writer or many readers.

Type Definitions

Barrier

A primitive that synchronizes the execution of multiple threads. See barrier::Barrier for documentation.

Lazy

A value which is initialized on the first access. See lazy::Lazy for documentation.

Mutex

A primitive that synchronizes the execution of multiple threads. See mutex::Mutex for documentation.

Once

A primitive that provides lazy one-time initialization. See once::Once for documentation.

RwLock

A lock that provides data access to either one writer or many readers. See rwlock::RwLock for documentation.

RwLockUpgradableGuard

A guard that provides immutable data access but can be upgraded to RwLockWriteGuard. See rwlock::RwLockUpgradableGuard for documentation.

RwLockWriteGuard

A guard that provides mutable data access. See rwlock::RwLockWriteGuard for documentation.