timer: finish updating timer (#1222)

* timer: restructure feature flags
* update timer tests
* Add `async-traits` to CI

This also disables a buggy `threadpool` test. This test should be fixed in the future.

Refs #1225
This commit is contained in:
Carl Lerche
2019-06-30 08:48:53 -07:00
committed by GitHub
parent 8e7d8af588
commit b2c777846e
27 changed files with 786 additions and 755 deletions
+3 -4
View File
@@ -4,7 +4,6 @@ use std::cell::RefCell;
use std::fmt;
use std::sync::{Arc, Weak};
use std::time::Instant;
use tokio_executor::Enter;
/// Handle to timer instance.
///
@@ -58,9 +57,9 @@ thread_local! {
///
/// [`Delay`]: ../struct.Delay.html
/// [`Delay::new`]: ../struct.Delay.html#method.new
pub fn with_default<F, R>(handle: &Handle, enter: &mut Enter, f: F) -> R
pub fn with_default<F, R>(handle: &Handle, f: F) -> R
where
F: FnOnce(&mut Enter) -> R,
F: FnOnce() -> R,
{
// Ensure that the timer is removed from the thread-local context
// when leaving the scope. This handles cases that involve panicking.
@@ -96,7 +95,7 @@ where
*current = Some(handle.clone());
}
f(enter)
f()
})
}
+1 -1
View File
@@ -43,7 +43,7 @@ impl Registration {
}
// Used by `Timeout<Stream>`
#[cfg(feature = "timeout-stream")]
#[cfg(feature = "async-traits")]
pub fn reset_timeout(&mut self) {
let deadline = crate::clock::now() + self.entry.time_ref().duration;
self.entry.time_mut().deadline = deadline;