Crate atomic [] [src]

Generic Atomic<T> wrapper type

Atomic types provide primitive shared-memory communication between threads, and are the building blocks of other concurrent types.

This library defines a generic atomic wrapper type Atomic<T> for all T: Copy types. Atomic types present operations that, when used correctly, synchronize updates between threads.

Each method takes an Ordering which represents the strength of the memory barrier for that operation. These orderings are the same as LLVM atomic orderings.

Atomic variables are safe to share between threads (they implement Sync) but they do not themselves provide the mechanism for sharing. The most common way to share an atomic variable is to put it into an Arc (an atomically-reference-counted shared pointer).

Most atomic types may be stored in static variables, initialized using the const fn constructors (only available on nightly). Atomic statics are often used for lazy global initialization.

Structs

Atomic

A generic atomic wrapper type which allows an object to be safely shared between threads.

Enums

Ordering

Atomic memory orderings

Functions

fence

An atomic fence.