about summary refs log tree commit diff
path: root/src/libstd/sync/mpsc/select.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2015-01-24 09:15:42 -0800
committerBrian Anderson <banderson@mozilla.com>2015-01-25 01:20:55 -0800
commit63fcbcf3ce8f0ca391c18b2d61833ae6beb3ac70 (patch)
treec732033c0822f25f2aebcdf193de1b257bac1855 /src/libstd/sync/mpsc/select.rs
parentb44ee371b8beea77aa1364460acbba14a8516559 (diff)
parent0430a43d635841db44978bb648e9cf7e7cfa1bba (diff)
downloadrust-63fcbcf3ce8f0ca391c18b2d61833ae6beb3ac70.tar.gz
rust-63fcbcf3ce8f0ca391c18b2d61833ae6beb3ac70.zip
Merge remote-tracking branch 'rust-lang/master'
Conflicts:
	mk/tests.mk
	src/liballoc/arc.rs
	src/liballoc/boxed.rs
	src/liballoc/rc.rs
	src/libcollections/bit.rs
	src/libcollections/btree/map.rs
	src/libcollections/btree/set.rs
	src/libcollections/dlist.rs
	src/libcollections/ring_buf.rs
	src/libcollections/slice.rs
	src/libcollections/str.rs
	src/libcollections/string.rs
	src/libcollections/vec.rs
	src/libcollections/vec_map.rs
	src/libcore/any.rs
	src/libcore/array.rs
	src/libcore/borrow.rs
	src/libcore/error.rs
	src/libcore/fmt/mod.rs
	src/libcore/iter.rs
	src/libcore/marker.rs
	src/libcore/ops.rs
	src/libcore/result.rs
	src/libcore/slice.rs
	src/libcore/str/mod.rs
	src/libregex/lib.rs
	src/libregex/re.rs
	src/librustc/lint/builtin.rs
	src/libstd/collections/hash/map.rs
	src/libstd/collections/hash/set.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/mutex.rs
	src/libstd/sync/poison.rs
	src/libstd/sync/rwlock.rs
	src/libsyntax/feature_gate.rs
	src/libsyntax/test.rs
Diffstat (limited to 'src/libstd/sync/mpsc/select.rs')
-rw-r--r--src/libstd/sync/mpsc/select.rs41
1 files changed, 7 insertions, 34 deletions
diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs
index ee4d3a55481..e97c82a5b1b 100644
--- a/src/libstd/sync/mpsc/select.rs
+++ b/src/libstd/sync/mpsc/select.rs
@@ -60,6 +60,7 @@ use core::prelude::*;
 use core::cell::Cell;
 use core::marker;
 use core::mem;
+use core::ptr;
 use core::uint;
 
 use sync::mpsc::{Receiver, RecvError};
@@ -67,24 +68,12 @@ use sync::mpsc::blocking::{self, SignalToken};
 
 /// The "receiver set" of the select interface. This structure is used to manage
 /// a set of receivers which are being selected over.
-#[cfg(stage0)] // NOTE remove impl after next snapshot
 pub struct Select {
     head: *mut Handle<'static, ()>,
     tail: *mut Handle<'static, ()>,
     next_id: Cell<uint>,
-    marker1: marker::NoSend,
 }
 
-/// The "receiver set" of the select interface. This structure is used to manage
-/// a set of receivers which are being selected over.
-#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
-pub struct Select {
-    head: *mut Handle<'static, ()>,
-    tail: *mut Handle<'static, ()>,
-    next_id: Cell<uint>,
-}
-
-#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
 impl !marker::Send for Select {}
 
 /// A handle to a receiver which is currently a member of a `Select` set of
@@ -127,26 +116,10 @@ impl Select {
     ///
     /// Usage of this struct directly can sometimes be burdensome, and usage is
     /// rather much easier through the `select!` macro.
-    #[cfg(stage0)] // NOTE remove impl after next snapshot
-    pub fn new() -> Select {
-        Select {
-            marker1: marker::NoSend,
-            head: 0 as *mut Handle<'static, ()>,
-            tail: 0 as *mut Handle<'static, ()>,
-            next_id: Cell::new(1),
-        }
-    }
-
-    /// Creates a new selection structure. This set is initially empty and
-    /// `wait` will panic!() if called.
-    ///
-    /// Usage of this struct directly can sometimes be burdensome, and usage is
-    /// rather much easier through the `select!` macro.
-    #[cfg(not(stage0))] // NOTE remove cfg after next snapshot
     pub fn new() -> Select {
         Select {
-            head: 0 as *mut Handle<'static, ()>,
-            tail: 0 as *mut Handle<'static, ()>,
+            head: ptr::null_mut(),
+            tail: ptr::null_mut(),
             next_id: Cell::new(1),
         }
     }
@@ -160,8 +133,8 @@ impl Select {
         Handle {
             id: id,
             selector: self,
-            next: 0 as *mut Handle<'static, ()>,
-            prev: 0 as *mut Handle<'static, ()>,
+            next: ptr::null_mut(),
+            prev: ptr::null_mut(),
             added: false,
             rx: rx,
             packet: rx,
@@ -326,8 +299,8 @@ impl<'rx, T: Send> Handle<'rx, T> {
             (*self.next).prev = self.prev;
         }
 
-        self.next = 0 as *mut Handle<'static, ()>;
-        self.prev = 0 as *mut Handle<'static, ()>;
+        self.next = ptr::null_mut();
+        self.prev = ptr::null_mut();
 
         self.added = false;
     }