Function std::sync::atomic::compiler_fence
[−]
[src]
pub fn compiler_fence(order: Ordering)
A compiler memory fence.
compiler_fence does not emit any machine code, but prevents the compiler from re-ordering
memory operations across this point. Which reorderings are disallowed is dictated by the given
Ordering. Note that compiler_fence does not introduce inter-thread memory
synchronization; for that, a fence is needed.
The re-ordering prevented by the different ordering semantics are:
- with
SeqCst, no re-ordering of reads and writes across this point is allowed. - with
Release, preceding reads and writes cannot be moved past subsequent writes. - with
Acquire, subsequent reads and writes cannot be moved ahead of preceding reads. - with
AcqRel, both of the above rules are enforced.
Panics
Panics if order is Relaxed.