about summary refs log tree commit diff
path: root/src/libstd/sync/mpsc
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-01 23:53:35 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-03 23:43:57 -0800
commit7d8d06f86b48520814596bd5363d2b82bc619774 (patch)
treeeda093ca208286fd8679da8de9f3597b7a024c50 /src/libstd/sync/mpsc
parent470118f3e915cdc8f936aca0640b28a7a3d8dc6c (diff)
downloadrust-7d8d06f86b48520814596bd5363d2b82bc619774.tar.gz
rust-7d8d06f86b48520814596bd5363d2b82bc619774.zip
Remove deprecated functionality
This removes a large array of deprecated functionality, regardless of how
recently it was deprecated. The purpose of this commit is to clean out the
standard libraries and compiler for the upcoming alpha release.

Some notable compiler changes were to enable warnings for all now-deprecated
command line arguments (previously the deprecated versions were silently
accepted) as well as removing deriving(Zero) entirely (the trait was removed).

The distribution no longer contains the libtime or libregex_macros crates. Both
of these have been deprecated for some time and are available externally.
Diffstat (limited to 'src/libstd/sync/mpsc')
-rw-r--r--src/libstd/sync/mpsc/mpsc_queue.rs12
-rw-r--r--src/libstd/sync/mpsc/oneshot.rs34
-rw-r--r--src/libstd/sync/mpsc/shared.rs95
-rw-r--r--src/libstd/sync/mpsc/spsc_queue.rs41
-rw-r--r--src/libstd/sync/mpsc/stream.rs64
-rw-r--r--src/libstd/sync/mpsc/sync.rs13
6 files changed, 131 insertions, 128 deletions
diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs
index 8945233dac9..8f85dc6e043 100644
--- a/src/libstd/sync/mpsc/mpsc_queue.rs
+++ b/src/libstd/sync/mpsc/mpsc_queue.rs
@@ -48,7 +48,7 @@ use alloc::boxed::Box;
 use core::mem;
 use core::cell::UnsafeCell;
 
-use sync::atomic::{AtomicPtr, Release, Acquire, AcqRel, Relaxed};
+use sync::atomic::{AtomicPtr, Ordering};
 
 /// A result of the `pop` function.
 pub enum PopResult<T> {
@@ -103,8 +103,8 @@ impl<T: Send> Queue<T> {
     pub fn push(&self, t: T) {
         unsafe {
             let n = Node::new(Some(t));
-            let prev = self.head.swap(n, AcqRel);
-            (*prev).next.store(n, Release);
+            let prev = self.head.swap(n, Ordering::AcqRel);
+            (*prev).next.store(n, Ordering::Release);
         }
     }
 
@@ -121,7 +121,7 @@ impl<T: Send> Queue<T> {
     pub fn pop(&self) -> PopResult<T> {
         unsafe {
             let tail = *self.tail.get();
-            let next = (*tail).next.load(Acquire);
+            let next = (*tail).next.load(Ordering::Acquire);
 
             if !next.is_null() {
                 *self.tail.get() = next;
@@ -132,7 +132,7 @@ impl<T: Send> Queue<T> {
                 return Data(ret);
             }
 
-            if self.head.load(Acquire) == tail {Empty} else {Inconsistent}
+            if self.head.load(Ordering::Acquire) == tail {Empty} else {Inconsistent}
         }
     }
 }
@@ -143,7 +143,7 @@ impl<T: Send> Drop for Queue<T> {
         unsafe {
             let mut cur = *self.tail.get();
             while !cur.is_null() {
-                let next = (*cur).next.load(Relaxed);
+                let next = (*cur).next.load(Ordering::Relaxed);
                 let _: Box<Node<T>> = mem::transmute(cur);
                 cur = next;
             }
diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs
index 2811f403c6c..5c2331d0f2e 100644
--- a/src/libstd/sync/mpsc/oneshot.rs
+++ b/src/libstd/sync/mpsc/oneshot.rs
@@ -42,7 +42,7 @@ use core::prelude::*;
 use sync::mpsc::Receiver;
 use sync::mpsc::blocking::{self, SignalToken};
 use core::mem;
-use sync::atomic;
+use sync::atomic::{AtomicUint, Ordering};
 
 // Various states you can find a port in.
 const EMPTY: uint = 0;          // initial state: no data, no blocked reciever
@@ -56,7 +56,7 @@ const DISCONNECTED: uint = 2;   // channel is disconnected OR upgraded
 
 pub struct Packet<T> {
     // Internal state of the chan/port pair (stores the blocked task as well)
-    state: atomic::AtomicUint,
+    state: AtomicUint,
     // One-shot data slot location
     data: Option<T>,
     // when used for the second time, a oneshot channel must be upgraded, and
@@ -93,7 +93,7 @@ impl<T: Send> Packet<T> {
         Packet {
             data: None,
             upgrade: NothingSent,
-            state: atomic::AtomicUint::new(EMPTY),
+            state: AtomicUint::new(EMPTY),
         }
     }
 
@@ -107,7 +107,7 @@ impl<T: Send> Packet<T> {
         self.data = Some(t);
         self.upgrade = SendUsed;
 
-        match self.state.swap(DATA, atomic::SeqCst) {
+        match self.state.swap(DATA, Ordering::SeqCst) {
             // Sent the data, no one was waiting
             EMPTY => Ok(()),
 
@@ -141,14 +141,14 @@ impl<T: Send> Packet<T> {
     pub fn recv(&mut self) -> Result<T, Failure<T>> {
         // Attempt to not block the task (it's a little expensive). If it looks
         // like we're not empty, then immediately go through to `try_recv`.
-        if self.state.load(atomic::SeqCst) == EMPTY {
+        if self.state.load(Ordering::SeqCst) == EMPTY {
             let (wait_token, signal_token) = blocking::tokens();
             let ptr = unsafe { signal_token.cast_to_uint() };
 
             // race with senders to enter the blocking state
-            if self.state.compare_and_swap(EMPTY, ptr, atomic::SeqCst) == EMPTY {
+            if self.state.compare_and_swap(EMPTY, ptr, Ordering::SeqCst) == EMPTY {
                 wait_token.wait();
-                debug_assert!(self.state.load(atomic::SeqCst) != EMPTY);
+                debug_assert!(self.state.load(Ordering::SeqCst) != EMPTY);
             } else {
                 // drop the signal token, since we never blocked
                 drop(unsafe { SignalToken::cast_from_uint(ptr) });
@@ -159,7 +159,7 @@ impl<T: Send> Packet<T> {
     }
 
     pub fn try_recv(&mut self) -> Result<T, Failure<T>> {
-        match self.state.load(atomic::SeqCst) {
+        match self.state.load(Ordering::SeqCst) {
             EMPTY => Err(Empty),
 
             // We saw some data on the channel, but the channel can be used
@@ -169,7 +169,7 @@ impl<T: Send> Packet<T> {
             // the state changes under our feet we'd rather just see that state
             // change.
             DATA => {
-                self.state.compare_and_swap(DATA, EMPTY, atomic::SeqCst);
+                self.state.compare_and_swap(DATA, EMPTY, Ordering::SeqCst);
                 match self.data.take() {
                     Some(data) => Ok(data),
                     None => unreachable!(),
@@ -209,7 +209,7 @@ impl<T: Send> Packet<T> {
         };
         self.upgrade = GoUp(up);
 
-        match self.state.swap(DISCONNECTED, atomic::SeqCst) {
+        match self.state.swap(DISCONNECTED, Ordering::SeqCst) {
             // If the channel is empty or has data on it, then we're good to go.
             // Senders will check the data before the upgrade (in case we
             // plastered over the DATA state).
@@ -225,7 +225,7 @@ impl<T: Send> Packet<T> {
     }
 
     pub fn drop_chan(&mut self) {
-        match self.state.swap(DISCONNECTED, atomic::SeqCst) {
+        match self.state.swap(DISCONNECTED, Ordering::SeqCst) {
             DATA | DISCONNECTED | EMPTY => {}
 
             // If someone's waiting, we gotta wake them up
@@ -236,7 +236,7 @@ impl<T: Send> Packet<T> {
     }
 
     pub fn drop_port(&mut self) {
-        match self.state.swap(DISCONNECTED, atomic::SeqCst) {
+        match self.state.swap(DISCONNECTED, Ordering::SeqCst) {
             // An empty channel has nothing to do, and a remotely disconnected
             // channel also has nothing to do b/c we're about to run the drop
             // glue
@@ -259,7 +259,7 @@ impl<T: Send> Packet<T> {
     // If Ok, the value is whether this port has data, if Err, then the upgraded
     // port needs to be checked instead of this one.
     pub fn can_recv(&mut self) -> Result<bool, Receiver<T>> {
-        match self.state.load(atomic::SeqCst) {
+        match self.state.load(Ordering::SeqCst) {
             EMPTY => Ok(false), // Welp, we tried
             DATA => Ok(true),   // we have some un-acquired data
             DISCONNECTED if self.data.is_some() => Ok(true), // we have data
@@ -284,7 +284,7 @@ impl<T: Send> Packet<T> {
     // because there is data, or fail because there is an upgrade pending.
     pub fn start_selection(&mut self, token: SignalToken) -> SelectionResult<T> {
         let ptr = unsafe { token.cast_to_uint() };
-        match self.state.compare_and_swap(EMPTY, ptr, atomic::SeqCst) {
+        match self.state.compare_and_swap(EMPTY, ptr, Ordering::SeqCst) {
             EMPTY => SelSuccess,
             DATA => {
                 drop(unsafe { SignalToken::cast_from_uint(ptr) });
@@ -322,7 +322,7 @@ impl<T: Send> Packet<T> {
     //
     // The return value indicates whether there's data on this port.
     pub fn abort_selection(&mut self) -> Result<bool, Receiver<T>> {
-        let state = match self.state.load(atomic::SeqCst) {
+        let state = match self.state.load(Ordering::SeqCst) {
             // Each of these states means that no further activity will happen
             // with regard to abortion selection
             s @ EMPTY |
@@ -331,7 +331,7 @@ impl<T: Send> Packet<T> {
 
             // If we've got a blocked task, then use an atomic to gain ownership
             // of it (may fail)
-            ptr => self.state.compare_and_swap(ptr, EMPTY, atomic::SeqCst)
+            ptr => self.state.compare_and_swap(ptr, EMPTY, Ordering::SeqCst)
         };
 
         // Now that we've got ownership of our state, figure out what to do
@@ -370,6 +370,6 @@ impl<T: Send> Packet<T> {
 #[unsafe_destructor]
 impl<T: Send> Drop for Packet<T> {
     fn drop(&mut self) {
-        assert_eq!(self.state.load(atomic::SeqCst), DISCONNECTED);
+        assert_eq!(self.state.load(Ordering::SeqCst), DISCONNECTED);
     }
 }
diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs
index cadac8e6272..4295d116aed 100644
--- a/src/libstd/sync/mpsc/shared.rs
+++ b/src/libstd/sync/mpsc/shared.rs
@@ -25,11 +25,12 @@ use core::prelude::*;
 use core::cmp;
 use core::int;
 
-use sync::{atomic, Mutex, MutexGuard};
-use sync::mpsc::mpsc_queue as mpsc;
+use sync::atomic::{AtomicUint, AtomicInt, AtomicBool, Ordering};
 use sync::mpsc::blocking::{self, SignalToken};
-use sync::mpsc::select::StartResult;
+use sync::mpsc::mpsc_queue as mpsc;
 use sync::mpsc::select::StartResult::*;
+use sync::mpsc::select::StartResult;
+use sync::{Mutex, MutexGuard};
 use thread::Thread;
 
 const DISCONNECTED: int = int::MIN;
@@ -41,17 +42,17 @@ const MAX_STEALS: int = 1 << 20;
 
 pub struct Packet<T> {
     queue: mpsc::Queue<T>,
-    cnt: atomic::AtomicInt, // How many items are on this channel
+    cnt: AtomicInt, // How many items are on this channel
     steals: int, // How many times has a port received without blocking?
-    to_wake: atomic::AtomicUint, // SignalToken for wake up
+    to_wake: AtomicUint, // SignalToken for wake up
 
     // The number of channels which are currently using this packet.
-    channels: atomic::AtomicInt,
+    channels: AtomicInt,
 
     // See the discussion in Port::drop and the channel send methods for what
     // these are used for
-    port_dropped: atomic::AtomicBool,
-    sender_drain: atomic::AtomicInt,
+    port_dropped: AtomicBool,
+    sender_drain: AtomicInt,
 
     // this lock protects various portions of this implementation during
     // select()
@@ -69,12 +70,12 @@ impl<T: Send> Packet<T> {
     pub fn new() -> Packet<T> {
         let p = Packet {
             queue: mpsc::Queue::new(),
-            cnt: atomic::AtomicInt::new(0),
+            cnt: AtomicInt::new(0),
             steals: 0,
-            to_wake: atomic::AtomicUint::new(0),
-            channels: atomic::AtomicInt::new(2),
-            port_dropped: atomic::AtomicBool::new(false),
-            sender_drain: atomic::AtomicInt::new(0),
+            to_wake: AtomicUint::new(0),
+            channels: AtomicInt::new(2),
+            port_dropped: AtomicBool::new(false),
+            sender_drain: AtomicInt::new(0),
             select_lock: Mutex::new(()),
         };
         return p;
@@ -98,10 +99,10 @@ impl<T: Send> Packet<T> {
                            token: Option<SignalToken>,
                            guard: MutexGuard<()>) {
         token.map(|token| {
-            assert_eq!(self.cnt.load(atomic::SeqCst), 0);
-            assert_eq!(self.to_wake.load(atomic::SeqCst), 0);
-            self.to_wake.store(unsafe { token.cast_to_uint() }, atomic::SeqCst);
-            self.cnt.store(-1, atomic::SeqCst);
+            assert_eq!(self.cnt.load(Ordering::SeqCst), 0);
+            assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
+            self.to_wake.store(unsafe { token.cast_to_uint() }, Ordering::SeqCst);
+            self.cnt.store(-1, Ordering::SeqCst);
 
             // This store is a little sketchy. What's happening here is that
             // we're transferring a blocker from a oneshot or stream channel to
@@ -134,7 +135,7 @@ impl<T: Send> Packet<T> {
 
     pub fn send(&mut self, t: T) -> Result<(), T> {
         // See Port::drop for what's going on
-        if self.port_dropped.load(atomic::SeqCst) { return Err(t) }
+        if self.port_dropped.load(Ordering::SeqCst) { return Err(t) }
 
         // Note that the multiple sender case is a little trickier
         // semantically than the single sender case. The logic for
@@ -161,12 +162,12 @@ impl<T: Send> Packet<T> {
         // preflight check serves as the definitive "this will never be
         // received". Once we get beyond this check, we have permanently
         // entered the realm of "this may be received"
-        if self.cnt.load(atomic::SeqCst) < DISCONNECTED + FUDGE {
+        if self.cnt.load(Ordering::SeqCst) < DISCONNECTED + FUDGE {
             return Err(t)
         }
 
         self.queue.push(t);
-        match self.cnt.fetch_add(1, atomic::SeqCst) {
+        match self.cnt.fetch_add(1, Ordering::SeqCst) {
             -1 => {
                 self.take_to_wake().signal();
             }
@@ -183,9 +184,9 @@ impl<T: Send> Packet<T> {
             n if n < DISCONNECTED + FUDGE => {
                 // see the comment in 'try' for a shared channel for why this
                 // window of "not disconnected" is ok.
-                self.cnt.store(DISCONNECTED, atomic::SeqCst);
+                self.cnt.store(DISCONNECTED, Ordering::SeqCst);
 
-                if self.sender_drain.fetch_add(1, atomic::SeqCst) == 0 {
+                if self.sender_drain.fetch_add(1, Ordering::SeqCst) == 0 {
                     loop {
                         // drain the queue, for info on the thread yield see the
                         // discussion in try_recv
@@ -198,7 +199,7 @@ impl<T: Send> Packet<T> {
                         }
                         // maybe we're done, if we're not the last ones
                         // here, then we need to go try again.
-                        if self.sender_drain.fetch_sub(1, atomic::SeqCst) == 1 {
+                        if self.sender_drain.fetch_sub(1, Ordering::SeqCst) == 1 {
                             break
                         }
                     }
@@ -239,15 +240,15 @@ impl<T: Send> Packet<T> {
     // Essentially the exact same thing as the stream decrement function.
     // Returns true if blocking should proceed.
     fn decrement(&mut self, token: SignalToken) -> StartResult {
-        assert_eq!(self.to_wake.load(atomic::SeqCst), 0);
+        assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
         let ptr = unsafe { token.cast_to_uint() };
-        self.to_wake.store(ptr, atomic::SeqCst);
+        self.to_wake.store(ptr, Ordering::SeqCst);
 
         let steals = self.steals;
         self.steals = 0;
 
-        match self.cnt.fetch_sub(1 + steals, atomic::SeqCst) {
-            DISCONNECTED => { self.cnt.store(DISCONNECTED, atomic::SeqCst); }
+        match self.cnt.fetch_sub(1 + steals, Ordering::SeqCst) {
+            DISCONNECTED => { self.cnt.store(DISCONNECTED, Ordering::SeqCst); }
             // If we factor in our steals and notice that the channel has no
             // data, we successfully sleep
             n => {
@@ -256,7 +257,7 @@ impl<T: Send> Packet<T> {
             }
         }
 
-        self.to_wake.store(0, atomic::SeqCst);
+        self.to_wake.store(0, Ordering::SeqCst);
         drop(unsafe { SignalToken::cast_from_uint(ptr) });
         Abort
     }
@@ -297,9 +298,9 @@ impl<T: Send> Packet<T> {
             // might decrement steals.
             Some(data) => {
                 if self.steals > MAX_STEALS {
-                    match self.cnt.swap(0, atomic::SeqCst) {
+                    match self.cnt.swap(0, Ordering::SeqCst) {
                         DISCONNECTED => {
-                            self.cnt.store(DISCONNECTED, atomic::SeqCst);
+                            self.cnt.store(DISCONNECTED, Ordering::SeqCst);
                         }
                         n => {
                             let m = cmp::min(n, self.steals);
@@ -316,7 +317,7 @@ impl<T: Send> Packet<T> {
             // See the discussion in the stream implementation for why we try
             // again.
             None => {
-                match self.cnt.load(atomic::SeqCst) {
+                match self.cnt.load(Ordering::SeqCst) {
                     n if n != DISCONNECTED => Err(Empty),
                     _ => {
                         match self.queue.pop() {
@@ -334,20 +335,20 @@ impl<T: Send> Packet<T> {
     // Prepares this shared packet for a channel clone, essentially just bumping
     // a refcount.
     pub fn clone_chan(&mut self) {
-        self.channels.fetch_add(1, atomic::SeqCst);
+        self.channels.fetch_add(1, Ordering::SeqCst);
     }
 
     // Decrement the reference count on a channel. This is called whenever a
     // Chan is dropped and may end up waking up a receiver. It's the receiver's
     // responsibility on the other end to figure out that we've disconnected.
     pub fn drop_chan(&mut self) {
-        match self.channels.fetch_sub(1, atomic::SeqCst) {
+        match self.channels.fetch_sub(1, Ordering::SeqCst) {
             1 => {}
             n if n > 1 => return,
             n => panic!("bad number of channels left {}", n),
         }
 
-        match self.cnt.swap(DISCONNECTED, atomic::SeqCst) {
+        match self.cnt.swap(DISCONNECTED, Ordering::SeqCst) {
             -1 => { self.take_to_wake().signal(); }
             DISCONNECTED => {}
             n => { assert!(n >= 0); }
@@ -357,10 +358,10 @@ impl<T: Send> Packet<T> {
     // See the long discussion inside of stream.rs for why the queue is drained,
     // and why it is done in this fashion.
     pub fn drop_port(&mut self) {
-        self.port_dropped.store(true, atomic::SeqCst);
+        self.port_dropped.store(true, Ordering::SeqCst);
         let mut steals = self.steals;
         while {
-            let cnt = self.cnt.compare_and_swap(steals, DISCONNECTED, atomic::SeqCst);
+            let cnt = self.cnt.compare_and_swap(steals, DISCONNECTED, Ordering::SeqCst);
             cnt != DISCONNECTED && cnt != steals
         } {
             // See the discussion in 'try_recv' for why we yield
@@ -376,8 +377,8 @@ impl<T: Send> Packet<T> {
 
     // Consumes ownership of the 'to_wake' field.
     fn take_to_wake(&mut self) -> SignalToken {
-        let ptr = self.to_wake.load(atomic::SeqCst);
-        self.to_wake.store(0, atomic::SeqCst);
+        let ptr = self.to_wake.load(Ordering::SeqCst);
+        self.to_wake.store(0, Ordering::SeqCst);
         assert!(ptr != 0);
         unsafe { SignalToken::cast_from_uint(ptr) }
     }
@@ -392,15 +393,15 @@ impl<T: Send> Packet<T> {
     // This is different than the stream version because there's no need to peek
     // at the queue, we can just look at the local count.
     pub fn can_recv(&mut self) -> bool {
-        let cnt = self.cnt.load(atomic::SeqCst);
+        let cnt = self.cnt.load(Ordering::SeqCst);
         cnt == DISCONNECTED || cnt - self.steals > 0
     }
 
     // increment the count on the channel (used for selection)
     fn bump(&mut self, amt: int) -> int {
-        match self.cnt.fetch_add(amt, atomic::SeqCst) {
+        match self.cnt.fetch_add(amt, Ordering::SeqCst) {
             DISCONNECTED => {
-                self.cnt.store(DISCONNECTED, atomic::SeqCst);
+                self.cnt.store(DISCONNECTED, Ordering::SeqCst);
                 DISCONNECTED
             }
             n => n
@@ -444,13 +445,13 @@ impl<T: Send> Packet<T> {
         // the channel count and figure out what we should do to make it
         // positive.
         let steals = {
-            let cnt = self.cnt.load(atomic::SeqCst);
+            let cnt = self.cnt.load(Ordering::SeqCst);
             if cnt < 0 && cnt != DISCONNECTED {-cnt} else {0}
         };
         let prev = self.bump(steals + 1);
 
         if prev == DISCONNECTED {
-            assert_eq!(self.to_wake.load(atomic::SeqCst), 0);
+            assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
             true
         } else {
             let cur = prev + steals + 1;
@@ -458,7 +459,7 @@ impl<T: Send> Packet<T> {
             if prev < 0 {
                 drop(self.take_to_wake());
             } else {
-                while self.to_wake.load(atomic::SeqCst) != 0 {
+                while self.to_wake.load(Ordering::SeqCst) != 0 {
                     Thread::yield_now();
                 }
             }
@@ -479,8 +480,8 @@ impl<T: Send> Drop for Packet<T> {
         // disconnection, but also a proper fence before the read of
         // `to_wake`, so this assert cannot be removed with also removing
         // the `to_wake` assert.
-        assert_eq!(self.cnt.load(atomic::SeqCst), DISCONNECTED);
-        assert_eq!(self.to_wake.load(atomic::SeqCst), 0);
-        assert_eq!(self.channels.load(atomic::SeqCst), 0);
+        assert_eq!(self.cnt.load(Ordering::SeqCst), DISCONNECTED);
+        assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
+        assert_eq!(self.channels.load(Ordering::SeqCst), 0);
     }
 }
diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs
index 15624601157..e8d6e380be5 100644
--- a/src/libstd/sync/mpsc/spsc_queue.rs
+++ b/src/libstd/sync/mpsc/spsc_queue.rs
@@ -41,7 +41,7 @@ use alloc::boxed::Box;
 use core::mem;
 use core::cell::UnsafeCell;
 
-use sync::atomic::{AtomicPtr, Relaxed, AtomicUint, Acquire, Release};
+use sync::atomic::{AtomicPtr, AtomicUint, Ordering};
 
 // Node within the linked list queue of messages to send
 struct Node<T> {
@@ -109,7 +109,7 @@ impl<T: Send> Queue<T> {
     pub unsafe fn new(bound: uint) -> Queue<T> {
         let n1 = Node::new();
         let n2 = Node::new();
-        (*n1).next.store(n2, Relaxed);
+        (*n1).next.store(n2, Ordering::Relaxed);
         Queue {
             tail: UnsafeCell::new(n2),
             tail_prev: AtomicPtr::new(n1),
@@ -131,8 +131,8 @@ impl<T: Send> Queue<T> {
             let n = self.alloc();
             assert!((*n).value.is_none());
             (*n).value = Some(t);
-            (*n).next.store(0 as *mut Node<T>, Relaxed);
-            (**self.head.get()).next.store(n, Release);
+            (*n).next.store(0 as *mut Node<T>, Ordering::Relaxed);
+            (**self.head.get()).next.store(n, Ordering::Release);
             *self.head.get() = n;
         }
     }
@@ -144,23 +144,23 @@ impl<T: Send> Queue<T> {
         // only one subtracting from the cache).
         if *self.first.get() != *self.tail_copy.get() {
             if self.cache_bound > 0 {
-                let b = self.cache_subtractions.load(Relaxed);
-                self.cache_subtractions.store(b + 1, Relaxed);
+                let b = self.cache_subtractions.load(Ordering::Relaxed);
+                self.cache_subtractions.store(b + 1, Ordering::Relaxed);
             }
             let ret = *self.first.get();
-            *self.first.get() = (*ret).next.load(Relaxed);
+            *self.first.get() = (*ret).next.load(Ordering::Relaxed);
             return ret;
         }
         // If the above fails, then update our copy of the tail and try
         // again.
-        *self.tail_copy.get() = self.tail_prev.load(Acquire);
+        *self.tail_copy.get() = self.tail_prev.load(Ordering::Acquire);
         if *self.first.get() != *self.tail_copy.get() {
             if self.cache_bound > 0 {
-                let b = self.cache_subtractions.load(Relaxed);
-                self.cache_subtractions.store(b + 1, Relaxed);
+                let b = self.cache_subtractions.load(Ordering::Relaxed);
+                self.cache_subtractions.store(b + 1, Ordering::Relaxed);
             }
             let ret = *self.first.get();
-            *self.first.get() = (*ret).next.load(Relaxed);
+            *self.first.get() = (*ret).next.load(Ordering::Relaxed);
             return ret;
         }
         // If all of that fails, then we have to allocate a new node
@@ -177,25 +177,26 @@ impl<T: Send> Queue<T> {
             // tail's next field and see if we can use it. If we do a pop, then
             // the current tail node is a candidate for going into the cache.
             let tail = *self.tail.get();
-            let next = (*tail).next.load(Acquire);
+            let next = (*tail).next.load(Ordering::Acquire);
             if next.is_null() { return None }
             assert!((*next).value.is_some());
             let ret = (*next).value.take();
 
             *self.tail.get() = next;
             if self.cache_bound == 0 {
-                self.tail_prev.store(tail, Release);
+                self.tail_prev.store(tail, Ordering::Release);
             } else {
                 // FIXME: this is dubious with overflow.
-                let additions = self.cache_additions.load(Relaxed);
-                let subtractions = self.cache_subtractions.load(Relaxed);
+                let additions = self.cache_additions.load(Ordering::Relaxed);
+                let subtractions = self.cache_subtractions.load(Ordering::Relaxed);
                 let size = additions - subtractions;
 
                 if size < self.cache_bound {
-                    self.tail_prev.store(tail, Release);
-                    self.cache_additions.store(additions + 1, Relaxed);
+                    self.tail_prev.store(tail, Ordering::Release);
+                    self.cache_additions.store(additions + 1, Ordering::Relaxed);
                 } else {
-                    (*self.tail_prev.load(Relaxed)).next.store(next, Relaxed);
+                    (*self.tail_prev.load(Ordering::Relaxed))
+                          .next.store(next, Ordering::Relaxed);
                     // We have successfully erased all references to 'tail', so
                     // now we can safely drop it.
                     let _: Box<Node<T>> = mem::transmute(tail);
@@ -217,7 +218,7 @@ impl<T: Send> Queue<T> {
         // stripped out.
         unsafe {
             let tail = *self.tail.get();
-            let next = (*tail).next.load(Acquire);
+            let next = (*tail).next.load(Ordering::Acquire);
             if next.is_null() { return None }
             return (*next).value.as_mut();
         }
@@ -230,7 +231,7 @@ impl<T: Send> Drop for Queue<T> {
         unsafe {
             let mut cur = *self.first.get();
             while !cur.is_null() {
-                let next = (*cur).next.load(Relaxed);
+                let next = (*cur).next.load(Ordering::Relaxed);
                 let _n: Box<Node<T>> = mem::transmute(cur);
                 cur = next;
             }
diff --git a/src/libstd/sync/mpsc/stream.rs b/src/libstd/sync/mpsc/stream.rs
index c526e6acb8f..bd1e74a3390 100644
--- a/src/libstd/sync/mpsc/stream.rs
+++ b/src/libstd/sync/mpsc/stream.rs
@@ -28,10 +28,10 @@ use core::cmp;
 use core::int;
 use thread::Thread;
 
+use sync::atomic::{AtomicInt, AtomicUint, Ordering, AtomicBool};
+use sync::mpsc::Receiver;
 use sync::mpsc::blocking::{self, SignalToken};
 use sync::mpsc::spsc_queue as spsc;
-use sync::mpsc::Receiver;
-use sync::atomic;
 
 const DISCONNECTED: int = int::MIN;
 #[cfg(test)]
@@ -42,11 +42,11 @@ const MAX_STEALS: int = 1 << 20;
 pub struct Packet<T> {
     queue: spsc::Queue<Message<T>>, // internal queue for all message
 
-    cnt: atomic::AtomicInt, // How many items are on this channel
+    cnt: AtomicInt, // How many items are on this channel
     steals: int, // How many times has a port received without blocking?
-    to_wake: atomic::AtomicUint, // SignalToken for the blocked thread to wake up
+    to_wake: AtomicUint, // SignalToken for the blocked thread to wake up
 
-    port_dropped: atomic::AtomicBool, // flag if the channel has been destroyed.
+    port_dropped: AtomicBool, // flag if the channel has been destroyed.
 }
 
 pub enum Failure<T> {
@@ -79,11 +79,11 @@ impl<T: Send> Packet<T> {
         Packet {
             queue: unsafe { spsc::Queue::new(128) },
 
-            cnt: atomic::AtomicInt::new(0),
+            cnt: AtomicInt::new(0),
             steals: 0,
-            to_wake: atomic::AtomicUint::new(0),
+            to_wake: AtomicUint::new(0),
 
-            port_dropped: atomic::AtomicBool::new(false),
+            port_dropped: AtomicBool::new(false),
         }
     }
 
@@ -91,7 +91,7 @@ impl<T: Send> Packet<T> {
         // If the other port has deterministically gone away, then definitely
         // must return the data back up the stack. Otherwise, the data is
         // considered as being sent.
-        if self.port_dropped.load(atomic::SeqCst) { return Err(t) }
+        if self.port_dropped.load(Ordering::SeqCst) { return Err(t) }
 
         match self.do_send(Data(t)) {
             UpSuccess | UpDisconnected => {},
@@ -103,14 +103,14 @@ impl<T: Send> Packet<T> {
     pub fn upgrade(&mut self, up: Receiver<T>) -> UpgradeResult {
         // If the port has gone away, then there's no need to proceed any
         // further.
-        if self.port_dropped.load(atomic::SeqCst) { return UpDisconnected }
+        if self.port_dropped.load(Ordering::SeqCst) { return UpDisconnected }
 
         self.do_send(GoUp(up))
     }
 
     fn do_send(&mut self, t: Message<T>) -> UpgradeResult {
         self.queue.push(t);
-        match self.cnt.fetch_add(1, atomic::SeqCst) {
+        match self.cnt.fetch_add(1, Ordering::SeqCst) {
             // As described in the mod's doc comment, -1 == wakeup
             -1 => UpWoke(self.take_to_wake()),
             // As as described before, SPSC queues must be >= -2
@@ -124,7 +124,7 @@ impl<T: Send> Packet<T> {
             // will never remove this data. We can only have at most one item to
             // drain (the port drains the rest).
             DISCONNECTED => {
-                self.cnt.store(DISCONNECTED, atomic::SeqCst);
+                self.cnt.store(DISCONNECTED, Ordering::SeqCst);
                 let first = self.queue.pop();
                 let second = self.queue.pop();
                 assert!(second.is_none());
@@ -143,8 +143,8 @@ impl<T: Send> Packet<T> {
 
     // Consumes ownership of the 'to_wake' field.
     fn take_to_wake(&mut self) -> SignalToken {
-        let ptr = self.to_wake.load(atomic::SeqCst);
-        self.to_wake.store(0, atomic::SeqCst);
+        let ptr = self.to_wake.load(Ordering::SeqCst);
+        self.to_wake.store(0, Ordering::SeqCst);
         assert!(ptr != 0);
         unsafe { SignalToken::cast_from_uint(ptr) }
     }
@@ -153,15 +153,15 @@ impl<T: Send> Packet<T> {
     // back if it shouldn't sleep. Note that this is the location where we take
     // steals into account.
     fn decrement(&mut self, token: SignalToken) -> Result<(), SignalToken> {
-        assert_eq!(self.to_wake.load(atomic::SeqCst), 0);
+        assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
         let ptr = unsafe { token.cast_to_uint() };
-        self.to_wake.store(ptr, atomic::SeqCst);
+        self.to_wake.store(ptr, Ordering::SeqCst);
 
         let steals = self.steals;
         self.steals = 0;
 
-        match self.cnt.fetch_sub(1 + steals, atomic::SeqCst) {
-            DISCONNECTED => { self.cnt.store(DISCONNECTED, atomic::SeqCst); }
+        match self.cnt.fetch_sub(1 + steals, Ordering::SeqCst) {
+            DISCONNECTED => { self.cnt.store(DISCONNECTED, Ordering::SeqCst); }
             // If we factor in our steals and notice that the channel has no
             // data, we successfully sleep
             n => {
@@ -170,7 +170,7 @@ impl<T: Send> Packet<T> {
             }
         }
 
-        self.to_wake.store(0, atomic::SeqCst);
+        self.to_wake.store(0, Ordering::SeqCst);
         Err(unsafe { SignalToken::cast_from_uint(ptr) })
     }
 
@@ -217,9 +217,9 @@ impl<T: Send> Packet<T> {
             // adding back in whatever we couldn't factor into steals.
             Some(data) => {
                 if self.steals > MAX_STEALS {
-                    match self.cnt.swap(0, atomic::SeqCst) {
+                    match self.cnt.swap(0, Ordering::SeqCst) {
                         DISCONNECTED => {
-                            self.cnt.store(DISCONNECTED, atomic::SeqCst);
+                            self.cnt.store(DISCONNECTED, Ordering::SeqCst);
                         }
                         n => {
                             let m = cmp::min(n, self.steals);
@@ -237,7 +237,7 @@ impl<T: Send> Packet<T> {
             }
 
             None => {
-                match self.cnt.load(atomic::SeqCst) {
+                match self.cnt.load(Ordering::SeqCst) {
                     n if n != DISCONNECTED => Err(Empty),
 
                     // This is a little bit of a tricky case. We failed to pop
@@ -266,7 +266,7 @@ impl<T: Send> Packet<T> {
     pub fn drop_chan(&mut self) {
         // Dropping a channel is pretty simple, we just flag it as disconnected
         // and then wakeup a blocker if there is one.
-        match self.cnt.swap(DISCONNECTED, atomic::SeqCst) {
+        match self.cnt.swap(DISCONNECTED, Ordering::SeqCst) {
             -1 => { self.take_to_wake().signal(); }
             DISCONNECTED => {}
             n => { assert!(n >= 0); }
@@ -293,7 +293,7 @@ impl<T: Send> Packet<T> {
         // sends are gated on this flag, so we're immediately guaranteed that
         // there are a bounded number of active sends that we'll have to deal
         // with.
-        self.port_dropped.store(true, atomic::SeqCst);
+        self.port_dropped.store(true, Ordering::SeqCst);
 
         // Now that we're guaranteed to deal with a bounded number of senders,
         // we need to drain the queue. This draining process happens atomically
@@ -306,7 +306,7 @@ impl<T: Send> Packet<T> {
         let mut steals = self.steals;
         while {
             let cnt = self.cnt.compare_and_swap(
-                            steals, DISCONNECTED, atomic::SeqCst);
+                            steals, DISCONNECTED, Ordering::SeqCst);
             cnt != DISCONNECTED && cnt != steals
         } {
             loop {
@@ -351,9 +351,9 @@ impl<T: Send> Packet<T> {
 
     // increment the count on the channel (used for selection)
     fn bump(&mut self, amt: int) -> int {
-        match self.cnt.fetch_add(amt, atomic::SeqCst) {
+        match self.cnt.fetch_add(amt, Ordering::SeqCst) {
             DISCONNECTED => {
-                self.cnt.store(DISCONNECTED, atomic::SeqCst);
+                self.cnt.store(DISCONNECTED, Ordering::SeqCst);
                 DISCONNECTED
             }
             n => n
@@ -403,7 +403,7 @@ impl<T: Send> Packet<T> {
         // of time until the data is actually sent.
         if was_upgrade {
             assert_eq!(self.steals, 0);
-            assert_eq!(self.to_wake.load(atomic::SeqCst), 0);
+            assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
             return Ok(true)
         }
 
@@ -416,7 +416,7 @@ impl<T: Send> Packet<T> {
         // If we were previously disconnected, then we know for sure that there
         // is no task in to_wake, so just keep going
         let has_data = if prev == DISCONNECTED {
-            assert_eq!(self.to_wake.load(atomic::SeqCst), 0);
+            assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
             true // there is data, that data is that we're disconnected
         } else {
             let cur = prev + steals + 1;
@@ -439,7 +439,7 @@ impl<T: Send> Packet<T> {
             if prev < 0 {
                 drop(self.take_to_wake());
             } else {
-                while self.to_wake.load(atomic::SeqCst) != 0 {
+                while self.to_wake.load(Ordering::SeqCst) != 0 {
                     Thread::yield_now();
                 }
             }
@@ -478,7 +478,7 @@ impl<T: Send> Drop for Packet<T> {
         // disconnection, but also a proper fence before the read of
         // `to_wake`, so this assert cannot be removed with also removing
         // the `to_wake` assert.
-        assert_eq!(self.cnt.load(atomic::SeqCst), DISCONNECTED);
-        assert_eq!(self.to_wake.load(atomic::SeqCst), 0);
+        assert_eq!(self.cnt.load(Ordering::SeqCst), DISCONNECTED);
+        assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
     }
 }
diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs
index 0eee10898bc..6836888e67e 100644
--- a/src/libstd/sync/mpsc/sync.rs
+++ b/src/libstd/sync/mpsc/sync.rs
@@ -41,14 +41,15 @@ use self::Blocker::*;
 use vec::Vec;
 use core::mem;
 
-use sync::{atomic, Mutex, MutexGuard};
+use sync::atomic::{Ordering, AtomicUint};
 use sync::mpsc::blocking::{self, WaitToken, SignalToken};
 use sync::mpsc::select::StartResult::{self, Installed, Abort};
+use sync::{Mutex, MutexGuard};
 
 pub struct Packet<T> {
     /// Only field outside of the mutex. Just done for kicks, but mainly because
     /// the other shared channel already had the code implemented
-    channels: atomic::AtomicUint,
+    channels: AtomicUint,
 
     lock: Mutex<State<T>>,
 }
@@ -137,7 +138,7 @@ fn wakeup<T>(token: SignalToken, guard: MutexGuard<State<T>>) {
 impl<T: Send> Packet<T> {
     pub fn new(cap: uint) -> Packet<T> {
         Packet {
-            channels: atomic::AtomicUint::new(1),
+            channels: AtomicUint::new(1),
             lock: Mutex::new(State {
                 disconnected: false,
                 blocker: NoneBlocked,
@@ -304,12 +305,12 @@ impl<T: Send> Packet<T> {
     // Prepares this shared packet for a channel clone, essentially just bumping
     // a refcount.
     pub fn clone_chan(&self) {
-        self.channels.fetch_add(1, atomic::SeqCst);
+        self.channels.fetch_add(1, Ordering::SeqCst);
     }
 
     pub fn drop_chan(&self) {
         // Only flag the channel as disconnected if we're the last channel
-        match self.channels.fetch_sub(1, atomic::SeqCst) {
+        match self.channels.fetch_sub(1, Ordering::SeqCst) {
             1 => {}
             _ => return
         }
@@ -412,7 +413,7 @@ impl<T: Send> Packet<T> {
 #[unsafe_destructor]
 impl<T: Send> Drop for Packet<T> {
     fn drop(&mut self) {
-        assert_eq!(self.channels.load(atomic::SeqCst), 0);
+        assert_eq!(self.channels.load(Ordering::SeqCst), 0);
         let mut guard = self.lock.lock().unwrap();
         assert!(guard.queue.dequeue().is_none());
         assert!(guard.canceled.is_none());