core::sync::atomic::fence - Rust
Description: API documentation for the Rust `fence` fn in crate `core`.
Keywords: rust, rustlang, rust-lang, fence

# Function core::sync::atomic::fence 1.0.0 [−] [src]

    pub fn fence(order: Ordering)

An atomic fence.

A fence 'A' which has `Release` ordering semantics, synchronizes with a fence 'B' with (at least) `Acquire` semantics, if and only if there exists atomic operations X and Y, both operating on some atomic object 'M' such that A is sequenced before X, Y is synchronized before B and Y observes the change to M. This provides a happens-before dependence between A and B.

Atomic operations with `Release` or `Acquire` semantics can also synchronize with a fence.

A fence which has `SeqCst` ordering, in addition to having both `Acquire` and `Release` semantics, participates in the global program order of the other `SeqCst` operations and/or fences.

Accepts `Acquire`, `Release`, `AcqRel` and `SeqCst` orderings.

# Panics

Panics if `order` is `Relaxed`.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)