about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorAaron Turon <aturon@mozilla.com>2014-08-04 15:42:36 -0700
committerAaron Turon <aturon@mozilla.com>2014-08-04 16:03:21 -0700
commit68bde0a07396efb415d61047c6b2a8183f47ef30 (patch)
tree2a0d63e3153abbe4f62f15d06ee72c94c7772b2d /src/libstd/rt
parent9de20198aedb3c3419ee503755e04bcc198d3a94 (diff)
downloadrust-68bde0a07396efb415d61047c6b2a8183f47ef30.tar.gz
rust-68bde0a07396efb415d61047c6b2a8183f47ef30.zip
stabilize atomics (now atomic)
This commit stabilizes the `std::sync::atomics` module, renaming it to
`std::sync::atomic` to match library precedent elsewhere, and tightening
up behavior around incorrect memory ordering annotations.

The vast majority of the module is now `stable`. However, the
`AtomicOption` type has been deprecated, since it is essentially unused
and is not truly a primitive atomic type. It will eventually be replaced
by a higher-level abstraction like MVars.

Due to deprecations, this is a:

[breaking-change]
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/backtrace.rs8
-rw-r--r--src/libstd/rt/util.rs8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs
index 80493ebb4a9..6c02cc631f5 100644
--- a/src/libstd/rt/backtrace.rs
+++ b/src/libstd/rt/backtrace.rs
@@ -20,7 +20,7 @@ use option::{Some, None};
 use os;
 use result::{Ok, Err};
 use str::StrSlice;
-use sync::atomics;
+use sync::atomic;
 use unicode::char::UnicodeChar;
 
 pub use self::imp::write;
@@ -28,9 +28,9 @@ pub use self::imp::write;
 // For now logging is turned off by default, and this function checks to see
 // whether the magical environment variable is present to see if it's turned on.
 pub fn log_enabled() -> bool {
-    static mut ENABLED: atomics::AtomicInt = atomics::INIT_ATOMIC_INT;
+    static mut ENABLED: atomic::AtomicInt = atomic::INIT_ATOMIC_INT;
     unsafe {
-        match ENABLED.load(atomics::SeqCst) {
+        match ENABLED.load(atomic::SeqCst) {
             1 => return false,
             2 => return true,
             _ => {}
@@ -41,7 +41,7 @@ pub fn log_enabled() -> bool {
         Some(..) => 2,
         None => 1,
     };
-    unsafe { ENABLED.store(val, atomics::SeqCst); }
+    unsafe { ENABLED.store(val, atomic::SeqCst); }
     val == 2
 }
 
diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs
index fa30ddbcc48..ed24ed2a569 100644
--- a/src/libstd/rt/util.rs
+++ b/src/libstd/rt/util.rs
@@ -14,7 +14,7 @@ use libc::uintptr_t;
 use option::{Some, None, Option};
 use os;
 use str::Str;
-use sync::atomics;
+use sync::atomic;
 
 /// Dynamically inquire about whether we're running under V.
 /// You should usually not use this unless your test definitely
@@ -41,8 +41,8 @@ pub fn limit_thread_creation_due_to_osx_and_valgrind() -> bool {
 }
 
 pub fn min_stack() -> uint {
-    static mut MIN: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT;
-    match unsafe { MIN.load(atomics::SeqCst) } {
+    static mut MIN: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT;
+    match unsafe { MIN.load(atomic::SeqCst) } {
         0 => {}
         n => return n - 1,
     }
@@ -50,7 +50,7 @@ pub fn min_stack() -> uint {
     let amt = amt.unwrap_or(2 * 1024 * 1024);
     // 0 is our sentinel value, so ensure that we'll never see 0 after
     // initialization has run
-    unsafe { MIN.store(amt + 1, atomics::SeqCst); }
+    unsafe { MIN.store(amt + 1, atomic::SeqCst); }
     return amt;
 }