Add waker_fn (#18)
* Add waker_fn
* Add a waker_fn test
* Double sleep times
* More benches
* Prohibit recursive block_on calls
* Reformat code
diff --git a/tests/waker_panic.rs b/tests/waker_panic.rs
index bacdef6..eb77912 100644
--- a/tests/waker_panic.rs
+++ b/tests/waker_panic.rs
@@ -39,7 +39,7 @@
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
WAKER.store(Some(cx.waker().clone()));
$poll.fetch_add(1);
- thread::sleep(ms(200));
+ thread::sleep(ms(400));
if self.0.get() {
panic!()
@@ -156,7 +156,7 @@
assert_eq!(chan.len(), 0);
});
- thread::sleep(ms(100));
+ thread::sleep(ms(200));
w.wake();
drop(handle);
@@ -167,7 +167,7 @@
assert_eq!(DROP_T.load(), 0);
assert_eq!(chan.len(), 0);
- thread::sleep(ms(200));
+ thread::sleep(ms(400));
assert_eq!(POLL.load(), 2);
assert_eq!(SCHEDULE.load(), 1);
@@ -202,7 +202,7 @@
assert_eq!(chan.len(), 0);
});
- thread::sleep(ms(100));
+ thread::sleep(ms(200));
handle.cancel();
assert_eq!(POLL.load(), 2);
@@ -220,7 +220,7 @@
assert_eq!(DROP_T.load(), 0);
assert_eq!(chan.len(), 0);
- thread::sleep(ms(200));
+ thread::sleep(ms(400));
assert_eq!(POLL.load(), 2);
assert_eq!(SCHEDULE.load(), 1);
@@ -255,7 +255,7 @@
assert_eq!(chan.len(), 0);
});
- thread::sleep(ms(100));
+ thread::sleep(ms(200));
w.wake();
assert_eq!(POLL.load(), 2);
@@ -281,7 +281,7 @@
assert_eq!(DROP_T.load(), 0);
assert_eq!(chan.len(), 0);
- thread::sleep(ms(200));
+ thread::sleep(ms(400));
assert_eq!(POLL.load(), 2);
assert_eq!(SCHEDULE.load(), 1);
@@ -316,7 +316,7 @@
assert_eq!(chan.len(), 0);
});
- thread::sleep(ms(100));
+ thread::sleep(ms(200));
handle.cancel();
assert_eq!(POLL.load(), 2);
@@ -342,7 +342,7 @@
assert_eq!(DROP_T.load(), 0);
assert_eq!(chan.len(), 0);
- thread::sleep(ms(200));
+ thread::sleep(ms(400));
assert_eq!(POLL.load(), 2);
assert_eq!(SCHEDULE.load(), 1);