mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-26 00:00:16 +02:00
Implement Default for tokio_timer::Handle (#553)
This patch implements `Default` for `tokio_timer::Handle`. It returns a `Handle` instance that is not bound to a specific timer. Instead, it will use the timer for the current execution context. This is the same strategy used by `tokio_reactor::Handle`. Fixes #547
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use Error;
|
||||
use atomic::AtomicU64;
|
||||
use timer::{Handle, Inner};
|
||||
use timer::{HandlePriv, Inner};
|
||||
|
||||
use futures::Poll;
|
||||
use futures::task::AtomicTask;
|
||||
@@ -121,7 +121,7 @@ const SHUTDOWN: *mut Entry = 1 as *mut _;
|
||||
// ===== impl Entry =====
|
||||
|
||||
impl Entry {
|
||||
pub fn new(when: u64, handle: Handle) -> Entry {
|
||||
pub fn new(when: u64, handle: HandlePriv) -> Entry {
|
||||
assert!(when > 0 && when < u64::MAX);
|
||||
|
||||
Entry {
|
||||
@@ -137,7 +137,7 @@ impl Entry {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_elapsed(handle: Handle) -> Entry {
|
||||
pub fn new_elapsed(handle: HandlePriv) -> Entry {
|
||||
Entry {
|
||||
inner: handle.into_inner(),
|
||||
task: AtomicTask::new(),
|
||||
|
||||
Reference in New Issue
Block a user