about summary refs log tree commit diff
path: root/src/libnative
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnative')
-rw-r--r--src/libnative/io/timer_other.rs9
-rw-r--r--src/libnative/io/timer_timerfd.rs9
-rw-r--r--src/libnative/io/timer_win32.rs9
-rw-r--r--src/libnative/task.rs2
4 files changed, 13 insertions, 16 deletions
diff --git a/src/libnative/io/timer_other.rs b/src/libnative/io/timer_other.rs
index 569b4cbb258..0bf97d58ffd 100644
--- a/src/libnative/io/timer_other.rs
+++ b/src/libnative/io/timer_other.rs
@@ -46,7 +46,6 @@
 //!
 //! Note that all time units in this file are in *milliseconds*.
 
-use std::comm::Data;
 use libc;
 use std::mem;
 use std::os;
@@ -119,7 +118,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
             Some(timer) => timer, None => return
         };
         let tx = timer.tx.take_unwrap();
-        if tx.try_send(()) && timer.repeat {
+        if tx.send_opt(()).is_ok() && timer.repeat {
             timer.tx = Some(tx);
             timer.target += timer.interval;
             insert(timer, active);
@@ -162,14 +161,14 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
             1 => {
                 loop {
                     match messages.try_recv() {
-                        Data(Shutdown) => {
+                        Ok(Shutdown) => {
                             assert!(active.len() == 0);
                             break 'outer;
                         }
 
-                        Data(NewTimer(timer)) => insert(timer, &mut active),
+                        Ok(NewTimer(timer)) => insert(timer, &mut active),
 
-                        Data(RemoveTimer(id, ack)) => {
+                        Ok(RemoveTimer(id, ack)) => {
                             match dead.iter().position(|&(i, _)| id == i) {
                                 Some(i) => {
                                     let (_, i) = dead.remove(i).unwrap();
diff --git a/src/libnative/io/timer_timerfd.rs b/src/libnative/io/timer_timerfd.rs
index d37a39fc30e..3fd61dc1da5 100644
--- a/src/libnative/io/timer_timerfd.rs
+++ b/src/libnative/io/timer_timerfd.rs
@@ -28,7 +28,6 @@
 //!
 //! As with timer_other, all units in this file are in units of millseconds.
 
-use std::comm::Data;
 use libc;
 use std::ptr;
 use std::os;
@@ -107,7 +106,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
                     match list.as_slice().bsearch(|&(f, _, _)| f.cmp(&fd)) {
                         Some(i) => {
                             let (_, ref c, oneshot) = *list.get(i);
-                            (!c.try_send(()) || oneshot, i)
+                            (c.send_opt(()).is_err() || oneshot, i)
                         }
                         None => fail!("fd not active: {}", fd),
                     }
@@ -121,7 +120,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
 
         while incoming {
             match messages.try_recv() {
-                Data(NewTimer(fd, chan, one, timeval)) => {
+                Ok(NewTimer(fd, chan, one, timeval)) => {
                     // acknowledge we have the new channel, we will never send
                     // another message to the old channel
                     chan.send(());
@@ -149,7 +148,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
                     assert_eq!(ret, 0);
                 }
 
-                Data(RemoveTimer(fd, chan)) => {
+                Ok(RemoveTimer(fd, chan)) => {
                     match list.as_slice().bsearch(|&(f, _, _)| f.cmp(&fd)) {
                         Some(i) => {
                             drop(list.remove(i));
@@ -160,7 +159,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
                     chan.send(());
                 }
 
-                Data(Shutdown) => {
+                Ok(Shutdown) => {
                     assert!(list.len() == 0);
                     break 'outer;
                 }
diff --git a/src/libnative/io/timer_win32.rs b/src/libnative/io/timer_win32.rs
index 8b7592783da..a15898feb92 100644
--- a/src/libnative/io/timer_win32.rs
+++ b/src/libnative/io/timer_win32.rs
@@ -20,7 +20,6 @@
 //! Other than that, the implementation is pretty straightforward in terms of
 //! the other two implementations of timers with nothing *that* new showing up.
 
-use std::comm::Data;
 use libc;
 use std::ptr;
 use std::rt::rtio;
@@ -54,11 +53,11 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>) {
         if idx == 0 {
             loop {
                 match messages.try_recv() {
-                    Data(NewTimer(obj, c, one)) => {
+                    Ok(NewTimer(obj, c, one)) => {
                         objs.push(obj);
                         chans.push((c, one));
                     }
-                    Data(RemoveTimer(obj, c)) => {
+                    Ok(RemoveTimer(obj, c)) => {
                         c.send(());
                         match objs.iter().position(|&o| o == obj) {
                             Some(i) => {
@@ -68,7 +67,7 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>) {
                             None => {}
                         }
                     }
-                    Data(Shutdown) => {
+                    Ok(Shutdown) => {
                         assert_eq!(objs.len(), 1);
                         assert_eq!(chans.len(), 0);
                         break 'outer;
@@ -79,7 +78,7 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>) {
         } else {
             let remove = {
                 match chans.get(idx as uint - 1) {
-                    &(ref c, oneshot) => !c.try_send(()) || oneshot
+                    &(ref c, oneshot) => c.send_opt(()).is_err() || oneshot
                 }
             };
             if remove {
diff --git a/src/libnative/task.rs b/src/libnative/task.rs
index 871fc94bde4..ddfd46ecad9 100644
--- a/src/libnative/task.rs
+++ b/src/libnative/task.rs
@@ -274,7 +274,7 @@ mod tests {
             let _tx = tx;
             fail!()
         });
-        assert_eq!(rx.recv_opt(), None);
+        assert_eq!(rx.recv_opt(), Err(()));
     }
 
     #[test]