Change a return value of reactor::poll to io::Result. (#40)

* Change a return value of reactor::poll to io::Result.

* Revert "Change a return value of reactor::poll to io::Result."

This reverts commit 281d8c32d4.

* Return a result from reactor::poll.

* Drop a reactor if any error occurs. Fix warnings in tests.

* Update a documentation for reactor::turn.

* Unwrap the last turn() call in tests.
This commit is contained in:
dethoter
2017-12-19 16:15:30 -06:00
committed by Alex Crichton
parent 571e322755
commit 9303076a6b
3 changed files with 18 additions and 14 deletions
+3 -3
View File
@@ -10,13 +10,13 @@ use tokio::reactor::Reactor;
fn works() {
let mut r = Reactor::new().unwrap();
r.handle().wakeup();
r.turn(None);
r.turn(None).unwrap();
let now = Instant::now();
let mut n = 0;
while now.elapsed() < Duration::from_millis(10) {
n += 1;
r.turn(Some(Duration::from_millis(10)));
r.turn(Some(Duration::from_millis(10))).unwrap();
}
assert!(n < 5);
}
@@ -37,7 +37,7 @@ fn wakes() {
for _ in 0..N {
tx.send(()).unwrap();
r.turn(None);
r.turn(None).unwrap();
}
t.join().unwrap();
}