mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-17 00:00:11 +02:00
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:
@@ -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()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user