From 68bde0a07396efb415d61047c6b2a8183f47ef30 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Mon, 4 Aug 2014 15:42:36 -0700 Subject: 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] --- src/libstd/rt/backtrace.rs | 8 ++++---- src/libstd/rt/util.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/libstd/rt') 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; } -- cgit 1.4.1-3-g733a5