id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/src/time/driver/mod.rs:6
self.wheel.remove(entry); entry.set_when_internal(None); } /// Fires the entry if it needs to, otherwise queue it to be processed later. fn add_entry(&mut self, entry: Arc<Entry>, when: u64) { use crate::time::wheel::InsertError; entry.set_when_internal(Some(when)); match ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
60d81bbe10faf344ea18438a1c5ecb9173e6ec52
github
async-runtime
https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/time/driver/mod.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/mod.rs:1
//! Time driver mod atomic_stack; use self::atomic_stack::AtomicStack; mod entry; pub(super) use self::entry::Entry; mod handle; pub(crate) use self::handle::Handle; use crate::loom::sync::atomic::{AtomicU64, AtomicUsize}; use crate::park::{Park, Unpark}; use crate::time::{wheel, Error}; use crate::time::{Clock, Du...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
fcdf9345bf19e9a1e1664f01713f9eba54da27c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/driver/mod.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/mod.rs:4
T: Park, { /// Creates a new `Driver` instance that uses `park` to block the current /// thread and `clock` to get the current `Instant`. /// /// Specifying the source of time is useful when testing. pub(crate) fn new(park: T, clock: Clock) -> Driver<T> { let unpark = Box::new(park.unpark())...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
fcdf9345bf19e9a1e1664f01713f9eba54da27c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/driver/mod.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/mod.rs:1
//! Time driver mod atomic_stack; use self::atomic_stack::AtomicStack; mod entry; pub(super) use self::entry::Entry; mod handle; pub(crate) use self::handle::Handle; mod registration; pub(crate) use self::registration::Registration; mod stack; use self::stack::Stack; use crate::loom::sync::atomic::{AtomicU64, Ato...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/time/driver/mod.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/mod.rs:3
/// [delay]: crate::time::Delay /// [timeout]: crate::time::Timeout /// [interval]: crate::time::Interval #[derive(Debug)] pub(crate) struct Driver<T: Park> { /// Shared state inner: Arc<Inner>, /// Timer wheel wheel: wheel::Wheel<Stack>, /// Thread parker. The `Driver` park implementation delegat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/time/driver/mod.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/mod.rs:4
const MAX_TIMEOUTS: usize = usize::MAX >> 1; // ===== impl Driver ===== impl<T> Driver<T> where T: Park, { /// Creates a new `Driver` instance that uses `park` to block the current /// thread and `clock` to get the current `Instant`. /// /// Specifying the source of time is useful when testing. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/time/driver/mod.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/mod.rs:5
fn process(&mut self) { let now = crate::time::ms( self.clock.now() - self.inner.start, crate::time::Round::Down, ); let mut poll = wheel::Poll::new(now); while let Some(entry) = self.wheel.poll(&mut poll, &mut ()) { let when = entry.when_internal().e...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/time/driver/mod.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/mod.rs:6
self.add_entry(entry, next); } } } } fn clear_entry(&mut self, entry: &Arc<Entry>) { self.wheel.remove(entry, &mut ()); entry.set_when_internal(None); } /// Fires the entry if it needs to, otherwise queue it to be processed later. /// /// Ret...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/time/driver/mod.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/mod.rs:7
{ type Unpark = T::Unpark; type Error = T::Error; fn unpark(&self) -> Self::Unpark { self.park.unpark() } fn park(&mut self) -> Result<(), Self::Error> { self.process_queue(); match self.wheel.poll_at() { Some(when) => { let now = self.clock.now...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/time/driver/mod.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/mod.rs:8
self.process_queue(); match self.wheel.poll_at() { Some(when) => { let now = self.clock.now(); let deadline = self.expiration_instant(when); if deadline > now { let duration = cmp::min(deadline - now, duration); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/time/driver/mod.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/mod.rs:9
// Clear the wheel, using u64::MAX allows us to drain everything let mut poll = wheel::Poll::new(u64::MAX); while let Some(entry) = self.wheel.poll(&mut poll, &mut ()) { entry.error(Error::shutdown()); } self.park.shutdown(); self.is_shutdown = true; } } impl<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/time/driver/mod.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/mod.rs:10
#[cfg(all(test, loom))] fn num(&self, ordering: std::sync::atomic::Ordering) -> usize { self.num.load(ordering) } /// Increments the number of active timeouts fn increment(&self) -> Result<(), Error> { let mut curr = self.num.load(Relaxed); loop { if curr == MAX_TIME...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/time/driver/mod.rs
361
415
tokio-rs/tokio:tokio/src/time/driver/mod.rs:11
return 0; } crate::time::ms(deadline - self.start, crate::time::Round::Up) } } impl fmt::Debug for Inner { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Inner").finish() } } #[cfg(all(test, loom))] mod tests;
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/time/driver/mod.rs
401
415
tokio-rs/tokio:tokio/src/time/driver/mod.rs:3
/// [delay]: crate::time::Delay /// [timeout]: crate::time::Timeout /// [interval]: crate::time::Interval #[derive(Debug)] pub(crate) struct Driver<T> { /// Shared state inner: Arc<Inner>, /// Timer wheel wheel: wheel::Wheel<Stack>, /// Thread parker. The `Driver` park implementation delegates to ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/mod.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/mod.rs:4
impl<T> Driver<T> where T: Park, { /// Creates a new `Driver` instance that uses `park` to block the current /// thread and `clock` to get the current `Instant`. /// /// Specifying the source of time is useful when testing. pub(crate) fn new(park: T, clock: Clock) -> Driver<T> { let unpa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/mod.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/mod.rs:5
); let mut poll = wheel::Poll::new(now); while let Some(entry) = self.wheel.poll(&mut poll, &mut ()) { let when = entry.when_internal().expect("invalid internal entry state"); // Fire the entry entry.fire(when); // Track that the entry has been fired ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/mod.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/mod.rs:6
} fn clear_entry(&mut self, entry: &Arc<Entry>) { self.wheel.remove(entry, &mut ()); entry.set_when_internal(None); } /// Fires the entry if it needs to, otherwise queue it to be processed later. /// /// Returns `None` if the entry was fired. fn add_entry(&mut self, entry: Arc<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/mod.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/mod.rs:7
fn unpark(&self) -> Self::Unpark { self.park.unpark() } fn park(&mut self) -> Result<(), Self::Error> { self.process_queue(); match self.wheel.poll_at() { Some(when) => { let now = self.clock.now(); let deadline = self.expiration_instant(when...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/mod.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/mod.rs:8
let now = self.clock.now(); let deadline = self.expiration_instant(when); if deadline > now { let duration = cmp::min(deadline - now, duration); if self.clock.is_paused() { self.park.park_timeout(Duration::from_secs(0))?; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/mod.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/mod.rs:9
} } } // ===== impl Inner ===== impl Inner { fn new(start: Instant, unpark: Box<dyn Unpark>) -> Inner { Inner { num: AtomicUsize::new(0), elapsed: AtomicU64::new(0), process: AtomicStack::new(), start, unpark, } } fn elapsed(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/mod.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/mod.rs:10
} } } /// Decrements the number of active timeouts fn decrement(&self) { let prev = self.num.fetch_sub(1, Acquire); debug_assert!(prev <= MAX_TIMEOUTS); } fn queue(&self, entry: &Arc<Entry>) -> Result<(), Error> { if self.process.push(entry)? { // The ti...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/mod.rs
361
396
tokio-rs/tokio:tokio/src/time/driver/mod.rs:6
} fn clear_entry(&mut self, entry: &Arc<Entry>) { self.wheel.remove(entry, &mut ()); entry.set_when_internal(None); } /// Fires the entry if it needs to, otherwise queue it to be processed later. /// /// Returns `None` if the entry was fired. fn add_entry(&mut self, entry: Arc<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
28a93e604454d435476eb8bb2eee809fd86b001d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/28a93e604454d435476eb8bb2eee809fd86b001d/tokio/src/time/driver/mod.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/mod.rs:8
let now = self.clock.now(); let deadline = self.expiration_instant(when); if deadline > now { let duration = cmp::min(deadline - now, duration); if self.clock.is_paused() { self.park.park_timeout(Duration::from_secs(0))?; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
28a93e604454d435476eb8bb2eee809fd86b001d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/28a93e604454d435476eb8bb2eee809fd86b001d/tokio/src/time/driver/mod.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/mod.rs:1
//! Time driver mod atomic_stack; use self::atomic_stack::AtomicStack; mod entry; pub(super) use self::entry::Entry; mod handle; pub(crate) use self::handle::Handle; mod registration; pub(crate) use self::registration::Registration; mod stack; use self::stack::Stack; use crate::loom::sync::atomic::{AtomicU64, Ato...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
3fb213a8612699a46b2ccbeddd9adfbe3c468287
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3fb213a8612699a46b2ccbeddd9adfbe3c468287/tokio/src/time/driver/mod.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/mod.rs:3
/// Shared state inner: Arc<Inner>, /// Timer wheel wheel: wheel::Wheel<Stack>, /// Thread parker. The `Driver` park implementation delegates to this. park: T, /// Source of "now" instances clock: Clock, } /// Timer state shared between `Driver`, `Handle`, and `Registration`. pub(crate) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
3fb213a8612699a46b2ccbeddd9adfbe3c468287
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3fb213a8612699a46b2ccbeddd9adfbe3c468287/tokio/src/time/driver/mod.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/mod.rs:4
/// Creates a new `Driver` instance that uses `park` to block the current /// thread and `now` to get the current `Instant`. /// /// Specifying the source of time is useful when testing. pub(crate) fn new(park: T, clock: Clock) -> Driver<T> { let unpark = Box::new(park.unpark()); Driver...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
3fb213a8612699a46b2ccbeddd9adfbe3c468287
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3fb213a8612699a46b2ccbeddd9adfbe3c468287/tokio/src/time/driver/mod.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/mod.rs:5
// Fire the entry entry.fire(when); // Track that the entry has been fired entry.set_when_internal(None); } // Update the elapsed cache self.inner.elapsed.store(self.wheel.elapsed(), SeqCst); } /// Processes the entry queue /// /// This hand...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
3fb213a8612699a46b2ccbeddd9adfbe3c468287
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3fb213a8612699a46b2ccbeddd9adfbe3c468287/tokio/src/time/driver/mod.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/mod.rs:6
} /// Fires the entry if it needs to, otherwise queue it to be processed later. /// /// Returns `None` if the entry was fired. fn add_entry(&mut self, entry: Arc<Entry>, when: u64) { use crate::time::wheel::InsertError; entry.set_when_internal(Some(when)); match self.wheel.ins...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
3fb213a8612699a46b2ccbeddd9adfbe3c468287
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3fb213a8612699a46b2ccbeddd9adfbe3c468287/tokio/src/time/driver/mod.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/mod.rs:8
if self.clock.is_paused() { self.park.park_timeout(Duration::from_secs(0))?; self.clock.advance(duration); } else { self.park.park_timeout(duration)?; } } else { self.park....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
3fb213a8612699a46b2ccbeddd9adfbe3c468287
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3fb213a8612699a46b2ccbeddd9adfbe3c468287/tokio/src/time/driver/mod.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/mod.rs:9
impl Inner { fn new(start: Instant, unpark: Box<dyn Unpark>) -> Inner { Inner { num: AtomicUsize::new(0), elapsed: AtomicU64::new(0), process: AtomicStack::new(), start, unpark, } } fn elapsed(&self) -> u64 { self.elapsed.l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
3fb213a8612699a46b2ccbeddd9adfbe3c468287
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3fb213a8612699a46b2ccbeddd9adfbe3c468287/tokio/src/time/driver/mod.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/mod.rs:10
fn decrement(&self) { let prev = self.num.fetch_sub(1, Acquire); debug_assert!(prev <= MAX_TIMEOUTS); } fn queue(&self, entry: &Arc<Entry>) -> Result<(), Error> { if self.process.push(entry)? { // The timer is notified so that it can process the timeout self.unpa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
3fb213a8612699a46b2ccbeddd9adfbe3c468287
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3fb213a8612699a46b2ccbeddd9adfbe3c468287/tokio/src/time/driver/mod.rs
361
391
tokio-rs/tokio:tokio/src/time/driver/mod.rs:1
//! Time driver mod atomic_stack; use self::atomic_stack::AtomicStack; mod entry; pub(super) use self::entry::Entry; mod handle; pub(crate) use self::handle::Handle; mod registration; pub(crate) use self::registration::Registration; mod stack; use self::stack::Stack; use crate::loom::sync::atomic::{AtomicU64, Ato...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
57ba37c97854d32e691ea68006c8d69d58c79b23
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57ba37c97854d32e691ea68006c8d69d58c79b23/tokio/src/time/driver/mod.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/mod.rs:3
inner: Arc<Inner>, /// Timer wheel wheel: wheel::Wheel<Stack>, /// Thread parker. The `Driver` park implementation delegates to this. park: T, /// Source of "now" instances clock: Clock, } /// Timer state shared between `Driver`, `Handle`, and `Registration`. pub(crate) struct Inner { //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
57ba37c97854d32e691ea68006c8d69d58c79b23
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57ba37c97854d32e691ea68006c8d69d58c79b23/tokio/src/time/driver/mod.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/mod.rs:4
/// thread and `now` to get the current `Instant`. /// /// Specifying the source of time is useful when testing. pub(crate) fn new(park: T, clock: Clock) -> Driver<T> { let unpark = Box::new(park.unpark()); Driver { inner: Arc::new(Inner::new(clock.now(), unpark)), w...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
57ba37c97854d32e691ea68006c8d69d58c79b23
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57ba37c97854d32e691ea68006c8d69d58c79b23/tokio/src/time/driver/mod.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/mod.rs:5
// Fire the entry entry.fire(when); // Track that the entry has been fired entry.set_when_internal(None); } // Update the elapsed cache self.inner.elapsed.store(self.wheel.elapsed(), SeqCst); } /// Processes the entry queue /// /// This hand...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
57ba37c97854d32e691ea68006c8d69d58c79b23
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57ba37c97854d32e691ea68006c8d69d58c79b23/tokio/src/time/driver/mod.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/mod.rs:6
/// Fires the entry if it needs to, otherwise queue it to be processed later. /// /// Returns `None` if the entry was fired. fn add_entry(&mut self, entry: Arc<Entry>, when: u64) { use crate::time::wheel::InsertError; entry.set_when_internal(Some(when)); match self.wheel.insert(whe...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
57ba37c97854d32e691ea68006c8d69d58c79b23
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57ba37c97854d32e691ea68006c8d69d58c79b23/tokio/src/time/driver/mod.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/mod.rs:7
match self.wheel.poll_at() { Some(when) => { let now = self.clock.now(); let deadline = self.expiration_instant(when); if deadline > now { let dur = deadline - now; if self.clock.is_paused() { s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
57ba37c97854d32e691ea68006c8d69d58c79b23
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57ba37c97854d32e691ea68006c8d69d58c79b23/tokio/src/time/driver/mod.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/mod.rs:8
if self.clock.is_paused() { self.park.park_timeout(Duration::from_secs(0))?; self.clock.advance(duration); } else { self.park.park_timeout(duration)?; } } else { self.park....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
57ba37c97854d32e691ea68006c8d69d58c79b23
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57ba37c97854d32e691ea68006c8d69d58c79b23/tokio/src/time/driver/mod.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/mod.rs:9
impl Inner { fn new(start: Instant, unpark: Box<dyn Unpark>) -> Inner { Inner { num: AtomicUsize::new(0), elapsed: AtomicU64::new(0), process: AtomicStack::new(), start, unpark, } } fn elapsed(&self) -> u64 { self.elapsed.l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
57ba37c97854d32e691ea68006c8d69d58c79b23
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57ba37c97854d32e691ea68006c8d69d58c79b23/tokio/src/time/driver/mod.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/mod.rs:10
fn queue(&self, entry: &Arc<Entry>) -> Result<(), Error> { if self.process.push(entry)? { // The timer is notified so that it can process the timeout self.unpark.unpark(); } Ok(()) } fn normalize_deadline(&self, deadline: Instant) -> u64 { if deadline < ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
57ba37c97854d32e691ea68006c8d69d58c79b23
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57ba37c97854d32e691ea68006c8d69d58c79b23/tokio/src/time/driver/mod.rs
361
383
tokio-rs/tokio:tokio/src/time/driver/mod.rs:6
/// Fires the entry if it needs to, otherwise queue it to be processed later. /// /// Returns `None` if the entry was fired. fn add_entry(&mut self, entry: Arc<Entry>, when: u64) { use crate::time::wheel::InsertError; entry.set_when_internal(Some(when)); match self.wheel.insert(whe...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/time/driver/mod.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/mod.rs:7
match self.wheel.poll_at() { Some(when) => { let now = self.clock.now(); let deadline = self.expiration_instant(when); if deadline > now { let dur = deadline - now; if self.clock.is_frozen() { s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/time/driver/mod.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/mod.rs:8
if self.clock.is_frozen() { self.park.park_timeout(Duration::from_secs(0))?; self.clock.advance(duration); } else { self.park.park_timeout(duration)?; } } else { self.park....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/time/driver/mod.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/mod.rs:3
inner: Arc<Inner>, /// Timer wheel wheel: wheel::Wheel<Stack>, /// Thread parker. The `Driver` park implementation delegates to this. park: T, /// Source of "now" instances clock: Clock, } /// Timer state shared between `Driver`, `Handle`, and `Registration`. pub(crate) struct Inner { //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
f0006006ed9938115011c42f26cff16842eb534f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f0006006ed9938115011c42f26cff16842eb534f/tokio/src/time/driver/mod.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/mod.rs:4
/// thread and `now` to get the current `Instant`. /// /// Specifying the source of time is useful when testing. pub(crate) fn new(park: T, clock: Clock) -> Driver<T> { let unpark = Box::new(park.unpark()); Driver { inner: Arc::new(Inner::new(clock.now(), unpark)), w...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
f0006006ed9938115011c42f26cff16842eb534f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f0006006ed9938115011c42f26cff16842eb534f/tokio/src/time/driver/mod.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/mod.rs:5
// Fire the entry entry.fire(when); // Track that the entry has been fired entry.set_when_internal(None); } // Update the elapsed cache self.inner.elapsed.store(self.wheel.elapsed(), SeqCst); } /// Process the entry queue /// /// This handle...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
f0006006ed9938115011c42f26cff16842eb534f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f0006006ed9938115011c42f26cff16842eb534f/tokio/src/time/driver/mod.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/mod.rs:6
/// Fire the entry if it needs to, otherwise queue it to be processed later. /// /// Returns `None` if the entry was fired. fn add_entry(&mut self, entry: Arc<Entry>, when: u64) { use crate::time::wheel::InsertError; entry.set_when_internal(Some(when)); match self.wheel.insert(when...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
f0006006ed9938115011c42f26cff16842eb534f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f0006006ed9938115011c42f26cff16842eb534f/tokio/src/time/driver/mod.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/mod.rs:8
if self.clock.is_frozen() { self.park.park_timeout(Duration::from_secs(0))?; self.clock.advance(duration); } else { self.park.park_timeout(duration)?; } } else { self.park....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
f0006006ed9938115011c42f26cff16842eb534f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f0006006ed9938115011c42f26cff16842eb534f/tokio/src/time/driver/mod.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/mod.rs:9
impl Inner { fn new(start: Instant, unpark: Box<dyn Unpark>) -> Inner { Inner { num: AtomicUsize::new(0), elapsed: AtomicU64::new(0), process: AtomicStack::new(), start, unpark, } } fn elapsed(&self) -> u64 { self.elapsed.l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
f0006006ed9938115011c42f26cff16842eb534f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f0006006ed9938115011c42f26cff16842eb534f/tokio/src/time/driver/mod.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/mod.rs:1
//! Time driver mod atomic_stack; use self::atomic_stack::AtomicStack; mod entry; use self::entry::Entry; mod handle; pub(crate) use self::handle::Handle; mod registration; pub(crate) use self::registration::Registration; mod stack; use self::stack::Stack; use crate::loom::sync::atomic::{AtomicU64, AtomicUsize}; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
67bf9c36f347031ca05872d102a7f9abc8b465f0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/67bf9c36f347031ca05872d102a7f9abc8b465f0/tokio/src/time/driver/mod.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/mod.rs:6
/// Fire the entry if it needs to, otherwise queue it to be processed later. /// /// Returns `None` if the entry was fired. fn add_entry(&mut self, entry: Arc<Entry>, when: u64) { use crate::time::wheel::InsertError; entry.set_when_internal(Some(when)); match self.wheel.insert(when...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
67bf9c36f347031ca05872d102a7f9abc8b465f0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/67bf9c36f347031ca05872d102a7f9abc8b465f0/tokio/src/time/driver/mod.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/mod.rs:7
match self.wheel.poll_at() { Some(when) => { let now = self.clock.now(); let deadline = self.expiration_instant(when); if deadline > now { self.park.park_timeout(deadline - now)?; } else { self.park.park...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
67bf9c36f347031ca05872d102a7f9abc8b465f0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/67bf9c36f347031ca05872d102a7f9abc8b465f0/tokio/src/time/driver/mod.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/mod.rs:8
self.process(); Ok(()) } } impl<T> Drop for Driver<T> { fn drop(&mut self) { use std::u64; // Shutdown the stack of entries to process, preventing any new entries // from being pushed. self.inner.process.shutdown(); // Clear the wheel, using u64::MAX allows us...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
67bf9c36f347031ca05872d102a7f9abc8b465f0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/67bf9c36f347031ca05872d102a7f9abc8b465f0/tokio/src/time/driver/mod.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/mod.rs:9
/// Increment the number of active timeouts fn increment(&self) -> Result<(), Error> { let mut curr = self.num.load(SeqCst); loop { if curr == MAX_TIMEOUTS { return Err(Error::at_capacity()); } let actual = self.num.compare_and_swap(curr, curr + ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
67bf9c36f347031ca05872d102a7f9abc8b465f0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/67bf9c36f347031ca05872d102a7f9abc8b465f0/tokio/src/time/driver/mod.rs
321
369
tokio-rs/tokio:tokio/src/time/driver/mod.rs:1
//! Time driver mod atomic_stack; use self::atomic_stack::AtomicStack; mod entry; use self::entry::Entry; mod handle; pub(crate) use self::handle::{set_default, Handle}; mod registration; pub(crate) use self::registration::Registration; mod stack; use self::stack::Stack; use crate::loom::sync::atomic::{AtomicU64,...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
7b53b7b659fe1feeb30e768cad8fdadf9531beb6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b53b7b659fe1feeb30e768cad8fdadf9531beb6/tokio/src/time/driver/mod.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/mod.rs:3
/// [`Timeout`]: struct.Timeout.html /// [paper]: http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf /// [`handle`]: #method.handle /// [`turn`]: #method.turn /// [Handle.struct]: struct.Handle.html #[derive(Debug)] pub(crate) struct Driver<T> { /// Shared state inner: Arc<Inner>, /// T...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
dbcd1f9a0964c64d5aa335649eabea281ac59574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dbcd1f9a0964c64d5aa335649eabea281ac59574/tokio/src/time/driver/mod.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/mod.rs:4
// ===== impl Driver ===== impl<T> Driver<T> where T: Park, { /// Create a new `Driver` instance that uses `park` to block the current /// thread and `now` to get the current `Instant`. /// /// Specifying the source of time is useful when testing. pub(crate) fn new(park: T, clock: Clock) -> Dri...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
dbcd1f9a0964c64d5aa335649eabea281ac59574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dbcd1f9a0964c64d5aa335649eabea281ac59574/tokio/src/time/driver/mod.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/mod.rs:5
self.clock.now() - self.inner.start, crate::time::Round::Down, ); let mut poll = wheel::Poll::new(now); while let Some(entry) = self.wheel.poll(&mut poll, &mut ()) { let when = entry.when_internal().expect("invalid internal entry state"); // Fire the entry ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
dbcd1f9a0964c64d5aa335649eabea281ac59574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dbcd1f9a0964c64d5aa335649eabea281ac59574/tokio/src/time/driver/mod.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/mod.rs:6
} } } fn clear_entry(&mut self, entry: &Arc<Entry>) { self.wheel.remove(entry, &mut ()); entry.set_when_internal(None); } /// Fire the entry if it needs to, otherwise queue it to be processed later. /// /// Returns `None` if the entry was fired. fn add_entry(&mut se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
dbcd1f9a0964c64d5aa335649eabea281ac59574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dbcd1f9a0964c64d5aa335649eabea281ac59574/tokio/src/time/driver/mod.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/mod.rs:7
type Error = T::Error; fn unpark(&self) -> Self::Unpark { self.park.unpark() } fn park(&mut self) -> Result<(), Self::Error> { self.process_queue(); match self.wheel.poll_at() { Some(when) => { let now = self.clock.now(); let deadline = ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
dbcd1f9a0964c64d5aa335649eabea281ac59574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dbcd1f9a0964c64d5aa335649eabea281ac59574/tokio/src/time/driver/mod.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/mod.rs:8
} else { self.park.park_timeout(Duration::from_secs(0))?; } } None => { self.park.park_timeout(duration)?; } } self.process(); Ok(()) } } impl<T> Drop for Driver<T> { fn drop(&mut self) { u...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
dbcd1f9a0964c64d5aa335649eabea281ac59574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dbcd1f9a0964c64d5aa335649eabea281ac59574/tokio/src/time/driver/mod.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/mod.rs:9
start, unpark, } } fn elapsed(&self) -> u64 { self.elapsed.load(SeqCst) } /// Increment the number of active timeouts fn increment(&self) -> Result<(), Error> { let mut curr = self.num.load(SeqCst); loop { if curr == MAX_TIMEOUTS { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
dbcd1f9a0964c64d5aa335649eabea281ac59574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dbcd1f9a0964c64d5aa335649eabea281ac59574/tokio/src/time/driver/mod.rs
321
377
tokio-rs/tokio:tokio/src/time/driver/mod.rs:10
Ok(()) } fn normalize_deadline(&self, deadline: Instant) -> u64 { if deadline < self.start { return 0; } crate::time::ms(deadline - self.start, crate::time::Round::Up) } } impl fmt::Debug for Inner { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
dbcd1f9a0964c64d5aa335649eabea281ac59574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dbcd1f9a0964c64d5aa335649eabea281ac59574/tokio/src/time/driver/mod.rs
361
377
tokio-rs/tokio:tokio/src/time/driver/mod.rs:1
//! Time driver mod atomic_stack; use self::atomic_stack::AtomicStack; mod entry; use self::entry::Entry; mod handle; pub(crate) use self::handle::{set_default, Handle, HandlePriv}; mod registration; pub(crate) use self::registration::Registration; mod stack; use self::stack::Stack; use crate::loom::sync::atomic:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
942feab040e28d1e1547012a0fb81212299e6596
github
async-runtime
https://github.com/tokio-rs/tokio/blob/942feab040e28d1e1547012a0fb81212299e6596/tokio/src/time/driver/mod.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/mod.rs:1
//! Time driver mod atomic_stack; use self::atomic_stack::AtomicStack; mod entry; use self::entry::Entry; mod handle; pub(crate) use self::handle::{set_default, Handle, HandlePriv}; mod registration; pub(crate) use self::registration::Registration; mod stack; use self::stack::Stack; use crate::loom::sync::atomic:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/mod.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/time/driver/mod.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/registration.rs:1
use crate::time::driver::{Entry, Handle}; use crate::time::{Duration, Error, Instant}; use std::sync::Arc; use std::task::{self, Poll}; /// Registration with a timer. /// /// The association between a `Delay` instance and a timer is done lazily in /// `poll` #[derive(Debug)] pub(crate) struct Registration { entry...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/registration.rs
MIT
9f63911adc5b809fd3df7cfbb736897a86895e0c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/time/driver/registration.rs
1
56
tokio-rs/tokio:tokio/src/time/driver/registration.rs:1
use crate::time::driver::{Entry, Handle}; use crate::time::{Duration, Error, Instant}; use std::sync::Arc; use std::task::{self, Poll}; /// Registration with a timer. /// /// The association between a `Delay` instance and a timer is done lazily in /// `poll` #[derive(Debug)] pub(crate) struct Registration { entry...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/registration.rs
MIT
06a4d895ec8787386058a24b422dfa9a8514bc8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/time/driver/registration.rs
1
53
tokio-rs/tokio:tokio/src/time/driver/registration.rs:1
use crate::time::driver::{Entry, Handle}; use crate::time::{Duration, Error, Instant}; use std::sync::Arc; use std::task::{self, Poll}; /// Registration with a timer. /// /// The association between a `Delay` instance and a timer is done lazily in /// `poll` #[derive(Debug)] pub(crate) struct Registration { entry...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/registration.rs
MIT
f0006006ed9938115011c42f26cff16842eb534f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f0006006ed9938115011c42f26cff16842eb534f/tokio/src/time/driver/registration.rs
1
50
tokio-rs/tokio:tokio/src/time/driver/registration.rs:1
use crate::time::driver::Entry; use crate::time::{Duration, Error, Instant}; use std::sync::Arc; use std::task::{self, Poll}; /// Registration with a timer. /// /// The association between a `Delay` instance and a timer is done lazily in /// `poll` #[derive(Debug)] pub(crate) struct Registration { entry: Arc<Entr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/registration.rs
MIT
3e643c7b81736a4c2b11387a6f71aba99450270b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e643c7b81736a4c2b11387a6f71aba99450270b/tokio/src/time/driver/registration.rs
1
48
tokio-rs/tokio:tokio/src/time/driver/registration.rs:1
use crate::time::driver::Entry; use crate::time::{Duration, Error, Instant}; use std::sync::Arc; use std::task::{self, Poll}; /// Registration with a timer. /// /// The association between a `Delay` instance and a timer is done lazily in /// `poll` #[derive(Debug)] pub(crate) struct Registration { entry: Arc<Entr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/registration.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/time/driver/registration.rs
1
57
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:6
/// use std::pin::Pin; /// use std::task::{Context, Poll}; /// use tokio::time::Sleep; /// use pin_project_lite::pin_project; /// /// pin_project! { /// struct HasSleep { /// #[pin] /// sleep: Sleep, /// } /// } /// /// impl Future for HasSleep { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
3cc616877d7f0122b4547f4ccd6a6c13b61b2036
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3cc616877d7f0122b4547f4ccd6a6c13b61b2036/tokio/src/time/driver/sleep.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:7
ctx: trace::AsyncOpTracingCtx, time_source: ClockTime, } } cfg_not_trace! { #[derive(Debug)] struct Inner { deadline: Instant, } } impl Sleep { #[cfg_attr(not(all(tokio_unstable, feature = "tracing")), allow(unused_variables))] #[track_caller] pub(crate) fn new_timeout( ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
3cc616877d7f0122b4547f4ccd6a6c13b61b2036
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3cc616877d7f0122b4547f4ccd6a6c13b61b2036/tokio/src/time/driver/sleep.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:6
/// use std::pin::Pin; /// use std::task::{Context, Poll}; /// use tokio::time::Sleep; /// use pin_project_lite::pin_project; /// /// pin_project! { /// struct HasSleep { /// #[pin] /// sleep: Sleep, /// } /// } /// /// impl Future for HasSleep { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
0abe825b72603a489fa56c46eefd8c27a8848196
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0abe825b72603a489fa56c46eefd8c27a8848196/tokio/src/time/driver/sleep.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:7
ctx: trace::AsyncOpTracingCtx, time_source: ClockTime, } } cfg_not_trace! { #[derive(Debug)] struct Inner { deadline: Instant, } } impl Sleep { #[cfg_attr(not(all(tokio_unstable, feature = "tracing")), allow(unused_variables))] pub(crate) fn new_timeout( deadline: Insta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
0abe825b72603a489fa56c46eefd8c27a8848196
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0abe825b72603a489fa56c46eefd8c27a8848196/tokio/src/time/driver/sleep.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:8
duration = duration, duration.unit = "ms", duration.op = "override", ); tracing::trace_span!("runtime.resource.async_op", source = "Sleep::new_timeout") }); let async_op_poll_span = async_op_span.in_scope(|...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
0abe825b72603a489fa56c46eefd8c27a8848196
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0abe825b72603a489fa56c46eefd8c27a8848196/tokio/src/time/driver/sleep.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:9
/// /// A `Sleep` instance is elapsed when the requested duration has elapsed. pub fn is_elapsed(&self) -> bool { self.entry.is_elapsed() } /// Resets the `Sleep` instance to a new deadline. /// /// Calling this function allows changing the instant at which the `Sleep` /// future co...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
0abe825b72603a489fa56c46eefd8c27a8848196
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0abe825b72603a489fa56c46eefd8c27a8848196/tokio/src/time/driver/sleep.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:10
let me = self.project(); me.entry.reset(deadline); (*me.inner).deadline = deadline; #[cfg(all(tokio_unstable, feature = "tracing"))] { let _resource_enter = me.inner.ctx.resource_span.enter(); me.inner.ctx.async_op_span = tracing::trace_span!("run...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
0abe825b72603a489fa56c46eefd8c27a8848196
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0abe825b72603a489fa56c46eefd8c27a8848196/tokio/src/time/driver/sleep.rs
361
420
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:11
let coop = ready!(crate::coop::poll_proceed(cx)); let result = me.entry.poll_elapsed(cx).map(move |r| { coop.made_progress(); r }); #[cfg(all(tokio_unstable, feature = "tracing"))] return trace_poll_op!("poll_elapsed", result); #[cfg(any(not(tokio_unsta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
0abe825b72603a489fa56c46eefd8c27a8848196
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0abe825b72603a489fa56c46eefd8c27a8848196/tokio/src/time/driver/sleep.rs
401
440
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:6
/// use tokio::time::Sleep; /// use pin_project_lite::pin_project; /// /// pin_project! { /// struct HasSleep { /// #[pin] /// sleep: Sleep, /// } /// } /// /// impl Future for HasSleep { /// type Output = (); /// /// fn poll(self: Pin<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
dee26c92ddb32e23acb0c1587e775ddab29e07f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dee26c92ddb32e23acb0c1587e775ddab29e07f9/tokio/src/time/driver/sleep.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:7
} } cfg_not_trace! { #[derive(Debug)] struct Inner { deadline: Instant, } } impl Sleep { #[cfg_attr(not(all(tokio_unstable, feature = "tracing")), allow(unused_variables))] pub(crate) fn new_timeout( deadline: Instant, location: Option<&'static Location<'static>>, ) -> ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
dee26c92ddb32e23acb0c1587e775ddab29e07f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dee26c92ddb32e23acb0c1587e775ddab29e07f9/tokio/src/time/driver/sleep.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:8
duration.op = "override", ); tracing::trace_span!("runtime.resource.async_op", source = "Sleep::new_timeout") }); let async_op_poll_span = async_op_span.in_scope(|| tracing::trace_span!("runtime.resource.async_op.poll")); let ctx = t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
dee26c92ddb32e23acb0c1587e775ddab29e07f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dee26c92ddb32e23acb0c1587e775ddab29e07f9/tokio/src/time/driver/sleep.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:9
pub fn is_elapsed(&self) -> bool { self.entry.is_elapsed() } /// Resets the `Sleep` instance to a new deadline. /// /// Calling this function allows changing the instant at which the `Sleep` /// future completes without having to create new associated state. /// /// This function ca...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
dee26c92ddb32e23acb0c1587e775ddab29e07f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dee26c92ddb32e23acb0c1587e775ddab29e07f9/tokio/src/time/driver/sleep.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:10
(*me.inner).deadline = deadline; #[cfg(all(tokio_unstable, feature = "tracing"))] { let _resource_enter = me.inner.ctx.resource_span.enter(); me.inner.ctx.async_op_span = tracing::trace_span!("runtime.resource.async_op", source = "Sleep::reset"); let ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
dee26c92ddb32e23acb0c1587e775ddab29e07f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dee26c92ddb32e23acb0c1587e775ddab29e07f9/tokio/src/time/driver/sleep.rs
361
420
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:7
} } cfg_not_trace! { #[derive(Debug)] struct Inner { deadline: Instant, } } impl Sleep { #[cfg_attr(not(all(tokio_unstable, feature = "tracing")), allow(unused_variables))] pub(crate) fn new_timeout( deadline: Instant, location: Option<&'static Location<'static>>, ) -> ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/time/driver/sleep.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:9
pub fn is_elapsed(&self) -> bool { self.entry.is_elapsed() } /// Resets the `Sleep` instance to a new deadline. /// /// Calling this function allows changing the instant at which the `Sleep` /// future completes without having to create new associated state. /// /// This function ca...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/time/driver/sleep.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:10
(*me.inner).deadline = deadline; #[cfg(all(tokio_unstable, feature = "tracing"))] { let _resource_enter = me.inner.ctx.resource_span.enter(); me.inner.ctx.async_op_span = tracing::trace_span!("runtime.resource.async_op", source = "Sleep::reset"); let ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/time/driver/sleep.rs
361
420
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:6
/// use std::pin::Pin; /// use std::task::{Context, Poll}; /// use tokio::time::Sleep; /// use pin_project_lite::pin_project; /// /// pin_project! { /// struct HasSleep { /// #[pin] /// sleep: Sleep, /// } /// } /// /// impl Future for HasSleep { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
2c0e5c97049cbd527754477709839fb1f52ed282
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2c0e5c97049cbd527754477709839fb1f52ed282/tokio/src/time/driver/sleep.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:7
resource_span: tracing::Span, async_op_span: tracing::Span, time_source: ClockTime, } } cfg_not_trace! { #[derive(Debug)] struct Inner { deadline: Instant, } } impl Sleep { #[cfg_attr(not(all(tokio_unstable, feature = "tracing")), allow(unused_variables))] pub(crate) fn...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
2c0e5c97049cbd527754477709839fb1f52ed282
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2c0e5c97049cbd527754477709839fb1f52ed282/tokio/src/time/driver/sleep.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:8
tracing::trace_span!("runtime.resource.async_op", source = "Sleep::new_timeout"); tracing::trace!( target: "runtime::resource::state_update", parent: resource_span.id(), duration = duration, duration.unit = "ms", duration.op = ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
2c0e5c97049cbd527754477709839fb1f52ed282
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2c0e5c97049cbd527754477709839fb1f52ed282/tokio/src/time/driver/sleep.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:9
/// Resets the `Sleep` instance to a new deadline. /// /// Calling this function allows changing the instant at which the `Sleep` /// future completes without having to create new associated state. /// /// This function can be called both before and after the future has /// completed. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
2c0e5c97049cbd527754477709839fb1f52ed282
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2c0e5c97049cbd527754477709839fb1f52ed282/tokio/src/time/driver/sleep.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:10
me.inner.async_op_span = tracing::trace_span!("runtime.resource.async_op", source = "Sleep::reset"); tracing::trace!( target: "runtime::resource::state_update", parent: me.inner.resource_span.id(), duration = { let now = me...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
2c0e5c97049cbd527754477709839fb1f52ed282
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2c0e5c97049cbd527754477709839fb1f52ed282/tokio/src/time/driver/sleep.rs
361
420
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:11
let result = me.entry.poll_elapsed(cx).map(move |r| { coop.made_progress(); r }); trace_poll_op!("poll_elapsed", result, me.inner.resource_span.id()) } } } impl Future for Sleep { type Output = (); // `poll_elapsed` can return an error in t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
2c0e5c97049cbd527754477709839fb1f52ed282
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2c0e5c97049cbd527754477709839fb1f52ed282/tokio/src/time/driver/sleep.rs
401
433
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:1
use crate::time::driver::{Handle, TimerEntry}; use crate::time::{error::Error, Duration, Instant}; use crate::util::trace; use pin_project_lite::pin_project; use std::future::Future; use std::panic::Location; use std::pin::Pin; use std::task::{self, Poll}; cfg_trace! { use crate::time::driver::ClockTime; } /// W...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/time/driver/sleep.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:2
/// /// See the documentation for the [`Sleep`] type for more examples. /// /// [`Sleep`]: struct@crate::time::Sleep /// [`interval`]: crate::time::interval() // Alias for old name in 0.x #[cfg_attr(docsrs, doc(alias = "delay_until"))] #[track_caller] pub fn sleep_until(deadline: Instant) -> Sleep { return Sleep::n...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/time/driver/sleep.rs
41
100
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:5
/// } /// ``` /// Use in a struct with pin projection. This method avoids the `Box`, but /// the `HasSleep` struct will not be `Unpin` as a consequence. /// ``` /// use std::future::Future; /// use std::pin::Pin; /// use std::task::{Context, Poll}; /// use tokio::time::Sleep; /// use...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/time/driver/sleep.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:6
} cfg_trace! { #[derive(Debug)] struct Inner { deadline: Instant, resource_span: tracing::Span, async_op_span: tracing::Span, time_source: ClockTime, } } cfg_not_trace! { #[derive(Debug)] struct Inner { deadline: Instant, } } impl Sleep { #[cfg_attr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/time/driver/sleep.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:7
loc.file = location.file(), loc.line = location.line(), loc.col = location.column(), ); let async_op_span = tracing::trace_span!("runtime.resource.async_op", source = "Sleep::new_timeout"); tracing::trace!( target: "ru...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/time/driver/sleep.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:8
/// /// A `Sleep` instance is elapsed when the requested duration has elapsed. pub fn is_elapsed(&self) -> bool { self.entry.is_elapsed() } /// Resets the `Sleep` instance to a new deadline. /// /// Calling this function allows changing the instant at which the `Sleep` /// future co...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/time/driver/sleep.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:9
let me = self.project(); me.entry.reset(deadline); (*me.inner).deadline = deadline; #[cfg(all(tokio_unstable, feature = "tracing"))] { me.inner.async_op_span = tracing::trace_span!("runtime.resource.async_op", source = "Sleep::reset"); tracing::t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/time/driver/sleep.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/sleep.rs:10
// Keep track of task budget let coop = ready!(trace_poll_op!( "poll_elapsed", crate::coop::poll_proceed(cx), me.inner.resource_span.id(), )); let result = me.entry.poll_elapsed(cx).map(move |r| { coop.made_progress();...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/sleep.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/time/driver/sleep.rs
361
399