diff options
| author | Peter Marheine <peter@taricorp.net> | 2015-02-14 23:48:10 -0700 |
|---|---|---|
| committer | Peter Marheine <peter@taricorp.net> | 2015-04-25 19:41:21 -0600 |
| commit | 998c10d6b64f9a37d4cab33e09b9dfd551c76b92 (patch) | |
| tree | d3272508b6aa37ce49b633ede17dc8ce29b6fea4 /src/libcore | |
| parent | 0d8309ec0b13ebad02bbc76f93eff39edf4af2d0 (diff) | |
| download | rust-998c10d6b64f9a37d4cab33e09b9dfd551c76b92.tar.gz rust-998c10d6b64f9a37d4cab33e09b9dfd551c76b92.zip | |
Add singlethreaded fence intrinsics.
These new intrinsics are comparable to `atomic_signal_fence` in C++, ensuring the compiler will not reorder memory accesses across the barrier, nor will it emit any machine instructions for it. Closes #24118, implementing RFC 888.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/intrinsics.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 8ed89adec5b..d525ff64cac 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -139,6 +139,21 @@ extern "rust-intrinsic" { pub fn atomic_fence_rel(); pub fn atomic_fence_acqrel(); + /// A compiler-only memory barrier. + /// + /// Memory accesses will never be reordered across this barrier by the compiler, + /// but no instructions will be emitted for it. This is appropriate for operations + /// on the same thread that may be preempted, such as when interacting with signal + /// handlers. + #[cfg(not(stage0))] // SNAP 5520801 + pub fn atomic_singlethreadfence(); + #[cfg(not(stage0))] // SNAP 5520801 + pub fn atomic_singlethreadfence_acq(); + #[cfg(not(stage0))] // SNAP 5520801 + pub fn atomic_singlethreadfence_rel(); + #[cfg(not(stage0))] // SNAP 5520801 + pub fn atomic_singlethreadfence_acqrel(); + /// Aborts the execution of the process. pub fn abort() -> !; |
