diff options
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/backtrace.rs | 6 | ||||
| -rw-r--r-- | src/libstd/rt/unwind.rs | 12 | ||||
| -rw-r--r-- | src/libstd/rt/util.rs | 6 |
3 files changed, 12 insertions, 12 deletions
diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs index ae405e9400b..578239c9cc4 100644 --- a/src/libstd/rt/backtrace.rs +++ b/src/libstd/rt/backtrace.rs @@ -15,7 +15,7 @@ use prelude::v1::*; use os; -use sync::atomic; +use sync::atomic::{mod, Ordering}; pub use sys::backtrace::write; @@ -23,7 +23,7 @@ pub use sys::backtrace::write; // whether the magical environment variable is present to see if it's turned on. pub fn log_enabled() -> bool { static ENABLED: atomic::AtomicInt = atomic::ATOMIC_INT_INIT; - match ENABLED.load(atomic::SeqCst) { + match ENABLED.load(Ordering::SeqCst) { 1 => return false, 2 => return true, _ => {} @@ -33,7 +33,7 @@ pub fn log_enabled() -> bool { Some(..) => 2, None => 1, }; - ENABLED.store(val, atomic::SeqCst); + ENABLED.store(val, Ordering::SeqCst); val == 2 } diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index 99f791df474..a48a8edd82f 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -67,7 +67,7 @@ use fmt; use intrinsics; use libc::c_void; use mem; -use sync::atomic; +use sync::atomic::{mod, Ordering}; use sync::{Once, ONCE_INIT}; use rt::libunwind as uw; @@ -543,11 +543,11 @@ fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) -> // callback. Additionally, CALLBACK_CNT may briefly be higher than // MAX_CALLBACKS, so we're sure to clamp it as necessary. let callbacks = { - let amt = CALLBACK_CNT.load(atomic::SeqCst); + let amt = CALLBACK_CNT.load(Ordering::SeqCst); CALLBACKS[..cmp::min(amt, MAX_CALLBACKS)] }; for cb in callbacks.iter() { - match cb.load(atomic::SeqCst) { + match cb.load(Ordering::SeqCst) { 0 => {} n => { let f: Callback = unsafe { mem::transmute(n) }; @@ -584,18 +584,18 @@ fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) -> /// currently possible to unregister a callback once it has been registered. #[experimental] pub unsafe fn register(f: Callback) -> bool { - match CALLBACK_CNT.fetch_add(1, atomic::SeqCst) { + match CALLBACK_CNT.fetch_add(1, Ordering::SeqCst) { // The invocation code has knowledge of this window where the count has // been incremented, but the callback has not been stored. We're // guaranteed that the slot we're storing into is 0. n if n < MAX_CALLBACKS => { - let prev = CALLBACKS[n].swap(mem::transmute(f), atomic::SeqCst); + let prev = CALLBACKS[n].swap(mem::transmute(f), Ordering::SeqCst); rtassert!(prev == 0); true } // If we accidentally bumped the count too high, pull it back. _ => { - CALLBACK_CNT.store(MAX_CALLBACKS, atomic::SeqCst); + CALLBACK_CNT.store(MAX_CALLBACKS, Ordering::SeqCst); false } } diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index d6cf35ee3cd..883a01fa318 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -19,7 +19,7 @@ use libc::{self, uintptr_t}; use os; use slice; use str; -use sync::atomic; +use sync::atomic::{mod, Ordering}; /// Dynamically inquire about whether we're running under V. /// You should usually not use this unless your test definitely @@ -47,7 +47,7 @@ pub fn limit_thread_creation_due_to_osx_and_valgrind() -> bool { pub fn min_stack() -> uint { static MIN: atomic::AtomicUint = atomic::ATOMIC_UINT_INIT; - match MIN.load(atomic::SeqCst) { + match MIN.load(Ordering::SeqCst) { 0 => {} n => return n - 1, } @@ -55,7 +55,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 - MIN.store(amt + 1, atomic::SeqCst); + MIN.store(amt + 1, Ordering::SeqCst); return amt; } |
