Module std::sync[src]

Useful synchronization primitives

This modules contains useful safe and unsafe synchronization primitives. Most of the primitives in this module do not provide any sort of locking and/or blocking at all, but rather provide the necessary tools to build other types of concurrent primitives.

Modules

atomics

Atomic types

deque

A (mostly) lock-free concurrent work-stealing deque

mpmc_bounded_queue
mpsc_queue

A mostly lock-free multi-producer, single consumer queue.

spsc_queue

A single-producer single-consumer concurrent queue

Structs

Arc

An atomically reference counted wrapper for shared state.

Barrier

A barrier enables multiple tasks to synchronize the beginning of some computation.

Condvar

A condition variable, a mechanism for unlock-and-descheduling and signaling, for use with the lock types.

Future

A type encapsulating the result of a computation which may not be complete

Mutex

A wrapper type which provides synchronized access to the underlying data, of type T. A mutex always provides exclusive access, and concurrent requests will block while the mutex is already locked.

MutexGuard

An guard which is created by locking a mutex. Through this guard the underlying data can be accessed.

Once

A synchronization primitive which can be used to run a one-time global initialization. Useful for one-time initialization for FFI or related functionality. This type can only be constructed with the ONCE_INIT value.

RWLock

A dual-mode reader-writer lock. The data can be accessed mutably or immutably, and immutably-accessing tasks may run concurrently.

RWLockReadGuard

A guard which is created by locking an rwlock in read mode. Through this guard the underlying data can be accessed.

RWLockWriteGuard

A guard which is created by locking an rwlock in write mode. Through this guard the underlying data can be accessed.

Semaphore

A counting, blocking, bounded-waiting semaphore.

SemaphoreGuard

An RAII guard used to represent an acquired resource to a semaphore. When dropped, this value will release the resource back to the semaphore.

TaskPool

A task pool used to execute functions in parallel.

Weak

A weak pointer to an Arc.

Statics

pub static ONCE_INIT: Once = [definition]