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/timeout.rs:2 | ///
/// // Wrap the future with a `Timeout` set to expire in 10 milliseconds.
/// if let Err(_) = timeout(Duration::from_millis(10), rx).await {
/// println!("did not receive value within 10 ms");
/// }
/// # }
/// ```
pub fn timeout<T>(duration: Duration, future: T) -> Timeout<T>
where
T: Future,
{
let del... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/time/timeout.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/time/timeout.rs:3 | /// # tx.send(()).unwrap();
///
/// // Wrap the future with a `Timeout` set to expire 10 milliseconds into the
/// // future.
/// if let Err(_) = timeout_at(Instant::now() + Duration::from_millis(10), rx).await {
/// println!("did not receive value within 10 ms");
/// }
/// # }
/// ```
pub fn timeout_at<T>(deadline... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/time/timeout.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/time/timeout.rs:4 | impl<T> Timeout<T> {
pub(crate) fn new_with_delay(value: T, delay: Delay) -> Timeout<T> {
Timeout { value, delay }
}
/// Gets a reference to the underlying value in this timeout.
pub fn get_ref(&self) -> &T {
&self.value
}
/// Gets a mutable reference to the underlying value in... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/time/timeout.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/time/timeout.rs:5 | // Safety: X_X!
unsafe {
match self.map_unchecked_mut(|me| &mut me.delay).poll(cx) {
Poll::Ready(()) => Poll::Ready(Err(Elapsed(()))),
Poll::Pending => Poll::Pending,
}
}
}
}
// ===== impl Elapsed =====
impl fmt::Display for Elapsed {
fn ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/time/timeout.rs | 161 | 185 |
tokio-rs/tokio:tokio/src/time/timeout.rs:2 | /// // Wrap the future with a `Timeout` set to expire in 10 milliseconds.
/// if let Err(_) = timeout(Duration::from_millis(10), rx).await {
/// println!("did not receive value within 10 ms");
/// }
/// # }
/// ```
pub fn timeout<T>(duration: Duration, future: T) -> Timeout<T>
where
T: Future,
{
let delay =... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | 12be90e3fff4041ea6398fc8cd834c3ec173bce5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12be90e3fff4041ea6398fc8cd834c3ec173bce5/tokio/src/time/timeout.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/time/timeout.rs:3 | ///
/// // Wrap the future with a `Timeout` set to expire 10 milliseconds into the
/// // future.
/// if let Err(_) = timeout_at(Instant::now() + Duration::from_millis(10), rx).await {
/// println!("did not receive value within 10 ms");
/// }
/// # }
/// ```
pub fn timeout_at<T>(deadline: Instant, future: T) -> Tim... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | 12be90e3fff4041ea6398fc8cd834c3ec173bce5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12be90e3fff4041ea6398fc8cd834c3ec173bce5/tokio/src/time/timeout.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/time/timeout.rs:4 | impl<T> Timeout<T> {
pub(crate) fn new_with_delay(value: T, delay: Delay) -> Timeout<T> {
Timeout { value, delay }
}
/// Gets a reference to the underlying value in this timeout.
pub fn get_ref(&self) -> &T {
&self.value
}
/// Gets a mutable reference to the underlying value in... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | 12be90e3fff4041ea6398fc8cd834c3ec173bce5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12be90e3fff4041ea6398fc8cd834c3ec173bce5/tokio/src/time/timeout.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/time/timeout.rs:5 | unsafe {
match self.map_unchecked_mut(|me| &mut me.delay).poll(cx) {
Poll::Ready(()) => Poll::Ready(Err(Elapsed(()))),
Poll::Pending => Poll::Pending,
}
}
}
}
// ===== impl Elapsed =====
impl fmt::Display for Elapsed {
fn fmt(&self, fmt: &mut fmt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | 12be90e3fff4041ea6398fc8cd834c3ec173bce5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12be90e3fff4041ea6398fc8cd834c3ec173bce5/tokio/src/time/timeout.rs | 161 | 184 |
tokio-rs/tokio:tokio/src/time/timeout.rs:3 | ///
/// // Wrap the future with a `Timeout` set to expire 10 milliseconds into the
/// // future.
/// if let Err(_) = timeout_at(Instant::now() + Duration::from_millis(10), rx).await {
/// println!("did not receive value within 10 ms");
/// }
/// # }
/// ```
pub fn timeout_at<T>(deadline: Instant, future: T) -> Tim... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/time/timeout.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/time/timeout.rs:4 | }
/// Gets a mutable reference to the underlying value in this timeout.
pub fn get_mut(&mut self) -> &mut T {
&mut self.value
}
/// Consumes this timeout, returning the underlying value.
pub fn into_inner(self) -> T {
self.value
}
}
impl<T> Future for Timeout<T>
where
T: F... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/time/timeout.rs | 121 | 176 |
tokio-rs/tokio:tokio/src/time/timeout.rs:5 | // ===== impl Elapsed =====
impl fmt::Display for Elapsed {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
"deadline has elapsed".fmt(fmt)
}
}
impl std::error::Error for Elapsed {}
impl From<Elapsed> for std::io::Error {
fn from(_err: Elapsed) -> std::io::Error {
std::io::Er... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/time/timeout.rs | 161 | 176 |
tokio-rs/tokio:tokio/src/time/timeout.rs:3 | impl<T> Timeout<T> {
/// Create a new `Timeout` that allows `value` to execute for a duration of
/// at most `timeout`.
///
/// The exact behavior depends on if `value` is a `Future` or a `Stream`.
///
/// See [type] level documentation for more details.
///
/// [type]: #
///
///... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | 27e5b41067d01c0c9fac230c5addb58034201a63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/time/timeout.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/time/timeout.rs:4 | pub fn get_ref(&self) -> &T {
&self.value
}
/// Gets a mutable reference to the underlying value in this timeout.
pub fn get_mut(&mut self) -> &mut T {
&mut self.value
}
/// Consumes this timeout, returning the underlying value.
pub fn into_inner(self) -> T {
self.value... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | 27e5b41067d01c0c9fac230c5addb58034201a63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/time/timeout.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/time/timeout.rs:5 | // First, try polling the future
// Safety: we never move `self.value`
unsafe {
let p = self.as_mut().map_unchecked_mut(|me| &mut me.value);
if let Poll::Ready(v) = p.poll(cx) {
return Poll::Ready(Ok(v));
}
}
// Now check the timer
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | 27e5b41067d01c0c9fac230c5addb58034201a63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/time/timeout.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/time/timeout.rs:6 | if v.is_some() {
self.as_mut().get_unchecked_mut().delay.reset_timeout();
}
return Poll::Ready(v.map(Ok));
}
// Now check the timer
ready!(self.as_mut().map_unchecked_mut(|me| &mut me.delay).poll(cx));
// if delay was ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/timeout.rs | MIT | 27e5b41067d01c0c9fac230c5addb58034201a63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/time/timeout.rs | 201 | 231 |
tokio-rs/tokio:tokio/src/time/wheel/level.rs:1 | use super::{Item, OwnedItem};
use crate::time::wheel::Stack;
use std::fmt;
/// Wheel for a single level in the timer. This wheel contains 64 slots.
pub(crate) struct Level {
level: usize,
/// Bit field tracking which slots currently contain entries.
///
/// Using a bit field to track slots that conta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/level.rs | MIT | fcdf9345bf19e9a1e1664f01713f9eba54da27c5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/wheel/level.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/time/wheel/level.rs:2 | impl Level {
pub(crate) fn new(level: usize) -> Level {
// A value has to be Copy in order to use syntax like:
// let stack = Stack::default();
// ...
// slots: [stack; 64],
//
// Alternatively, since Stack is Default one can
// use syntax like:
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/level.rs | MIT | fcdf9345bf19e9a1e1664f01713f9eba54da27c5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/wheel/level.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/time/wheel/level.rs:3 | ctor(),
ctor(),
ctor(),
ctor(),
ctor(),
ctor(),
ctor(),
ctor(),
ctor(),
ctor(),
ctor(),
ctor(),
ctor(),
ctor(),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/level.rs | MIT | fcdf9345bf19e9a1e1664f01713f9eba54da27c5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/wheel/level.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/time/wheel/level.rs:4 | ctor(),
ctor(),
ctor(),
ctor(),
],
}
}
/// Finds the slot that needs to be processed next and returns the slot and
/// `Instant` at which this slot must be processed.
pub(crate) fn next_expiration(&self, now: u64) -> Option<Expiration>... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/level.rs | MIT | fcdf9345bf19e9a1e1664f01713f9eba54da27c5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/wheel/level.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/time/wheel/level.rs:5 | slot,
deadline,
})
}
fn next_occupied_slot(&self, now: u64) -> Option<usize> {
if self.occupied == 0 {
return None;
}
// Get the slot for now using Maths
let now_slot = (now / slot_range(self.level)) as usize;
let occupied = self.occupied... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/level.rs | MIT | fcdf9345bf19e9a1e1664f01713f9eba54da27c5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/wheel/level.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/time/wheel/level.rs:6 | pub(crate) fn pop_entry_slot(&mut self, slot: usize) -> Option<OwnedItem> {
let ret = self.slot[slot].pop();
if ret.is_some() && self.slot[slot].is_empty() {
// The bit is currently set
debug_assert!(self.occupied & occupied_bit(slot) != 0);
self.occupied ^= occupie... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/level.rs | MIT | fcdf9345bf19e9a1e1664f01713f9eba54da27c5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/wheel/level.rs | 201 | 259 |
tokio-rs/tokio:tokio/src/time/wheel/level.rs:7 | #[cfg(all(test, not(loom)))]
mod test {
use super::*;
#[test]
fn test_slot_for() {
for pos in 1..64 {
assert_eq!(pos as usize, slot_for(pos, 0));
}
for level in 1..5 {
for pos in level..64 {
let a = pos * 64_usize.pow(level as u32);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/level.rs | MIT | fcdf9345bf19e9a1e1664f01713f9eba54da27c5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/wheel/level.rs | 241 | 259 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:1 | use crate::time::{driver::Entry, error::InsertError};
mod level;
pub(crate) use self::level::Expiration;
use self::level::Level;
mod stack;
pub(crate) use self::stack::Stack;
use std::sync::Arc;
use std::usize;
pub(super) type Item = Entry;
pub(super) type OwnedItem = Arc<Item>;
/// Timing wheel implementation.
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 0893841f31542b2b04c5050a8a4a3c45cf867e55 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/wheel/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:2 | /// * ~ 12 day slots / ~ 2 yr range
levels: Vec<Level>,
}
/// Number of levels. Each level has 64 slots. By using 6 levels with 64 slots
/// each, the timer is able to track time up to 2 years into the future with a
/// precision of 1 millisecond.
const NUM_LEVELS: usize = 6;
/// The maximum duration of a `Sleep`... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 0893841f31542b2b04c5050a8a4a3c45cf867e55 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/wheel/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:3 | /// Returns `Ok` when the item is successfully inserted, `Err` otherwise.
///
/// `Err(Elapsed)` indicates that `when` represents an instant that has
/// already passed. In this case, the caller should fire the timeout
/// immediately.
///
/// `Err(Invalid)` indicates an invalid `when` argument ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 0893841f31542b2b04c5050a8a4a3c45cf867e55 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/wheel/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:4 | /// Instant at which to poll
pub(crate) fn poll_at(&self) -> Option<u64> {
self.next_expiration().map(|expiration| expiration.deadline)
}
/// Advances the timer up to the instant represented by `now`.
pub(crate) fn poll(&mut self, now: u64) -> Option<OwnedItem> {
loop {
// u... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 0893841f31542b2b04c5050a8a4a3c45cf867e55 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/wheel/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:5 | // Check all levels
for level in 0..NUM_LEVELS {
if let Some(expiration) = self.levels[level].next_expiration(self.elapsed) {
// There cannot be any expirations at a higher level that happen
// before this one.
debug_assert!(self.no_expirations_before(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 0893841f31542b2b04c5050a8a4a3c45cf867e55 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/wheel/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:6 | let when = item.when();
let next_level = expiration.level - 1;
self.levels[next_level].add_entry(when, item);
}
}
None
}
fn set_elapsed(&mut self, when: u64) {
assert!(
self.elapsed <= when,
"elapsed={:?}; when={:?}"... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 0893841f31542b2b04c5050a8a4a3c45cf867e55 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/wheel/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:7 | significant / 6
}
#[cfg(all(test, not(loom)))]
mod test {
use super::*;
#[test]
fn test_level_for() {
for pos in 1..64 {
assert_eq!(
0,
level_for(0, pos),
"level_for({}) -- binary = {:b}",
pos,
pos
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 0893841f31542b2b04c5050a8a4a3c45cf867e55 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/wheel/mod.rs | 241 | 295 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:8 | if pos < 64 {
let a = a + 1;
assert_eq!(
level,
level_for(0, a as u64),
"level_for({}) -- binary = {:b}",
a,
a
);
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 0893841f31542b2b04c5050a8a4a3c45cf867e55 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/wheel/mod.rs | 281 | 295 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:1 | use crate::time::driver::Entry;
mod level;
pub(crate) use self::level::Expiration;
use self::level::Level;
mod stack;
pub(crate) use self::stack::Stack;
use std::sync::Arc;
use std::usize;
pub(super) type Item = Entry;
pub(super) type OwnedItem = Arc<Item>;
/// Timing wheel implementation.
///
/// This type provid... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/time/wheel/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:2 | /// * ~ 12 day slots / ~ 2 yr range
levels: Vec<Level>,
}
/// Number of levels. Each level has 64 slots. By using 6 levels with 64 slots
/// each, the timer is able to track time up to 2 years into the future with a
/// precision of 1 millisecond.
const NUM_LEVELS: usize = 6;
/// The maximum duration of a `Sleep`... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/time/wheel/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:3 | /// * `item`: The item to insert into the wheel.
///
/// * `store`: The slab or `()` when using heap storage.
///
/// # Return
///
/// Returns `Ok` when the item is successfully inserted, `Err` otherwise.
///
/// `Err(Elapsed)` indicates that `when` represents an instant that has
///... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/time/wheel/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:4 | pub(crate) fn remove(&mut self, item: &Item) {
let when = item.when();
let level = self.level_for(when);
self.levels[level].remove_entry(when, item);
}
/// Instant at which to poll
pub(crate) fn poll_at(&self) -> Option<u64> {
self.next_expiration().map(|expiration| expirat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/time/wheel/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:5 | }
}
}
/// Returns the instant at which the next timeout expires.
fn next_expiration(&self) -> Option<Expiration> {
// Check all levels
for level in 0..NUM_LEVELS {
if let Some(expiration) = self.levels[level].next_expiration(self.elapsed) {
// There canno... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/time/wheel/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:6 | while let Some(item) = self.pop_entry(expiration) {
if expiration.level == 0 {
debug_assert_eq!(item.when(), expiration.deadline);
return Some(item);
} else {
let when = item.when();
let next_level = expiration.level - 1;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/time/wheel/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:7 | let masked = elapsed ^ when;
assert!(masked != 0, "elapsed={}; when={}", elapsed, when);
let leading_zeros = masked.leading_zeros() as usize;
let significant = 63 - leading_zeros;
significant / 6
}
#[cfg(all(test, not(loom)))]
mod test {
use super::*;
#[test]
fn test_level_for() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/time/wheel/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:8 | level_for(0, a as u64),
"level_for({}) -- binary = {:b}",
a,
a
);
}
if pos < 64 {
let a = a + 1;
assert_eq!(
level,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/time/wheel/mod.rs | 281 | 301 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:1 | use crate::time::driver::Entry;
mod level;
pub(crate) use self::level::Expiration;
use self::level::Level;
mod stack;
pub(crate) use self::stack::Stack;
use std::sync::Arc;
use std::usize;
pub(super) type Item = Entry;
pub(super) type OwnedItem = Arc<Item>;
/// Timing wheel implementation.
///
/// This type provid... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | fcdf9345bf19e9a1e1664f01713f9eba54da27c5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/wheel/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/time/wheel/mod.rs:2 | /// * ~ 12 day slots / ~ 2 yr range
levels: Vec<Level>,
}
/// Number of levels. Each level has 64 slots. By using 6 levels with 64 slots
/// each, the timer is able to track time up to 2 years into the future with a
/// precision of 1 millisecond.
const NUM_LEVELS: usize = 6;
/// The maximum duration of a delay
c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/mod.rs | MIT | fcdf9345bf19e9a1e1664f01713f9eba54da27c5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/wheel/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/time/wheel/stack.rs:1 | use super::{Item, OwnedItem};
use crate::time::driver::Entry;
use std::ptr;
/// A doubly linked stack
#[derive(Debug)]
pub(crate) struct Stack {
head: Option<OwnedItem>,
}
impl Default for Stack {
fn default() -> Stack {
Stack { head: None }
}
}
impl Stack {
pub(crate) fn is_empty(&self) -> ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/stack.rs | MIT | fcdf9345bf19e9a1e1664f01713f9eba54da27c5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/wheel/stack.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/time/wheel/stack.rs:2 | // Set the previous link on the old head
*entry.prev_stack.get() = ptr;
}
// Set this entry's next pointer
*entry.next_stack.get() = old;
}
// Update the head pointer
self.head = Some(entry);
}
/// Pops an item from the stack
pub... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/time/wheel/stack.rs | MIT | fcdf9345bf19e9a1e1664f01713f9eba54da27c5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/wheel/stack.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/timer/clock/mod.rs:1 | //! A configurable source of time.
//!
//! This module provides an API to get the current instant in such a way that
//! the source of time may be configured. This allows mocking out the source of
//! time in tests.
//!
//! The [`now`][n] function returns the current [`Instant`]. By default, it delegates
//! to [`Insta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/clock/mod.rs | MIT | 474befd23c368a34a5f45aab0f3945212109a803 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/474befd23c368a34a5f45aab0f3945212109a803/tokio/src/timer/clock/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/timer/clock/mod.rs:2 | /// Thread-local tracking the current clock
static CLOCK: Cell<Option<*const Clock>> = Cell::new(None)
}
/// Returns an `Instant` corresponding to "now".
///
/// This function delegates to the source of time configured for the current
/// execution context. By default, this is `Instant::now()`.
///
/// Note that, ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/clock/mod.rs | MIT | 474befd23c368a34a5f45aab0f3945212109a803 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/474befd23c368a34a5f45aab0f3945212109a803/tokio/src/timer/clock/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/timer/clock/mod.rs:3 | Clock {
now: Some(Arc::new(now)),
}
}
/// Return a new `Clock` instance that uses [`Instant::now`] as the source
/// of time.
///
/// [`Instant::now`]: std::time::Instant::now
pub fn system() -> Clock {
Clock { now: None }
}
/// Returns an instant correspond... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/clock/mod.rs | MIT | 474befd23c368a34a5f45aab0f3945212109a803 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/474befd23c368a34a5f45aab0f3945212109a803/tokio/src/timer/clock/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/timer/clock/mod.rs:4 | ///
/// This function panics if there already is a default clock set.
pub fn with_default<F, R>(clock: &Clock, f: F) -> R
where
F: FnOnce() -> R,
{
CLOCK.with(|cell| {
assert!(
cell.get().is_none(),
"default clock already set for execution context"
);
// Ensure t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/clock/mod.rs | MIT | 474befd23c368a34a5f45aab0f3945212109a803 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/474befd23c368a34a5f45aab0f3945212109a803/tokio/src/timer/clock/mod.rs | 121 | 149 |
tokio-rs/tokio:tokio/src/timer/delay.rs:1 | use crate::timer::timer::{HandlePriv, Registration};
use futures_core::ready;
use std::future::Future;
use std::pin::Pin;
use std::task::{self, Poll};
use std::time::{Duration, Instant};
/// A future that completes at a specified instant in time.
///
/// Instances of `Delay` perform no work and complete with `()` onc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/delay.rs | MIT | 630d3136dd863b26e7bfbd3e145f63d92f591243 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/630d3136dd863b26e7bfbd3e145f63d92f591243/tokio/src/timer/delay.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/timer/delay.rs:2 | Delay { registration }
}
pub(crate) fn new_timeout(deadline: Instant, duration: Duration) -> Delay {
let registration = Registration::new(deadline, duration);
Delay { registration }
}
pub(crate) fn new_with_handle(
deadline: Instant,
duration: Duration,
handle: ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/delay.rs | MIT | 630d3136dd863b26e7bfbd3e145f63d92f591243 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/630d3136dd863b26e7bfbd3e145f63d92f591243/tokio/src/timer/delay.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/timer/delay.rs:3 | }
pub(crate) fn reset_timeout(&mut self) {
self.registration.reset_timeout();
}
/// Register the delay with the timer instance for the current execution
/// context.
fn register(&mut self) {
self.registration.register();
}
}
impl Future for Delay {
type Output = ();
f... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/delay.rs | MIT | 630d3136dd863b26e7bfbd3e145f63d92f591243 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/630d3136dd863b26e7bfbd3e145f63d92f591243/tokio/src/timer/delay.rs | 81 | 115 |
tokio-rs/tokio:tokio/src/timer/mod.rs:2 | //! println!("100 ms have elapsed");
//! }
//! ```
//!
//! Require that an operation takes no more than 300ms. Note that this uses the
//! [`timeout`][ext] function on the [`FutureExt`][ext] trait. This trait is
//! included in the prelude.
//!
//! ```
//! use tokio::prelude::*;
//! use std::time::Duration;
//!
//!... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/mod.rs | MIT | 9bec094150e869caae5105d7080f0ae54757b2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9bec094150e869caae5105d7080f0ae54757b2d9/tokio/src/timer/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/timer/mod.rs:3 | pub mod throttle;
// TODO: clean this up
#[allow(clippy::module_inception)]
pub mod timer;
pub use timer::{set_default, Timer};
pub mod timeout;
#[doc(inline)]
pub use timeout::Timeout;
mod atomic;
mod delay;
pub use self::delay::Delay;
mod error;
pub use error::Error;
mod interval;
pub use interval::Interval;
m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/mod.rs | MIT | 9bec094150e869caae5105d7080f0ae54757b2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9bec094150e869caae5105d7080f0ae54757b2d9/tokio/src/timer/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/timer/mod.rs:4 | enum Round {
Up,
Down,
}
/// Convert a `Duration` to milliseconds, rounding up and saturating at
/// `u64::MAX`.
///
/// The saturating is fine because `u64::MAX` milliseconds are still many
/// million years.
#[inline]
fn ms(duration: Duration, round: Round) -> u64 {
const NANOS_PER_MILLI: u32 = 1_000_000... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/mod.rs | MIT | 9bec094150e869caae5105d7080f0ae54757b2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9bec094150e869caae5105d7080f0ae54757b2d9/tokio/src/timer/mod.rs | 121 | 147 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:1 | use crate::sync::AtomicWaker;
use crate::timer::atomic::AtomicU64;
use crate::timer::timer::{HandlePriv, Inner};
use crate::timer::Error;
use std::cell::UnsafeCell;
use std::ptr;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering::{Relaxed, SeqCst};
use std::sync::{Arc, Weak};
use std::task::{self, Pol... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | e3261440e56ebf576790e4c6f7f125a6c8759659 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3261440e56ebf576790e4c6f7f125a6c8759659/tokio/src/timer/timer/entry.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:3 | pub(super) next_stack: UnsafeCell<Option<Arc<Entry>>>,
/// Previous entry in the State's linked list.
///
/// This is only accessed by the timer and is used to unlink a canceled
/// entry.
///
/// This is a weak reference.
pub(super) prev_stack: UnsafeCell<*const Entry>,
}
/// Stores the i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | e3261440e56ebf576790e4c6f7f125a6c8759659 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3261440e56ebf576790e4c6f7f125a6c8759659/tokio/src/timer/timer/entry.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:4 | /// Only called by `Registration`
pub(crate) fn time_ref(&self) -> &Time {
unsafe { &*self.time.0.get() }
}
/// Only called by `Registration`
#[allow(clippy::mut_from_ref)] // https://github.com/rust-lang/rust-clippy/issues/4281
pub(crate) unsafe fn time_mut(&self) -> &mut Time {
&m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | e3261440e56ebf576790e4c6f7f125a6c8759659 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3261440e56ebf576790e4c6f7f125a6c8759659/tokio/src/timer/timer/entry.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:5 | let inner = match handle.inner() {
Some(inner) => inner,
None => {
// Could not associate the entry with a timer, transition the
// state to error
Arc::get_mut(me).unwrap().transition_to_error();
return;
}
};
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | e3261440e56ebf576790e4c6f7f125a6c8759659 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3261440e56ebf576790e4c6f7f125a6c8759659/tokio/src/timer/timer/entry.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:6 | self.state = AtomicU64::new(ERROR);
}
/// The current entry state as known by the timer. This is not the value of
/// `state`, but lets the timer know how to converge its state to `state`.
pub(crate) fn when_internal(&self) -> Option<u64> {
unsafe { (*self.when.get()) }
}
pub(crate) fn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | e3261440e56ebf576790e4c6f7f125a6c8759659 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3261440e56ebf576790e4c6f7f125a6c8759659/tokio/src/timer/timer/entry.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:7 | let actual = self.state.compare_and_swap(curr, next, SeqCst);
if curr == actual {
break;
}
curr = actual;
}
self.waker.wake();
}
pub(crate) fn error(&self) {
// Only transition to the error state if not currently elapsed
let... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | e3261440e56ebf576790e4c6f7f125a6c8759659 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3261440e56ebf576790e4c6f7f125a6c8759659/tokio/src/timer/timer/entry.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:8 | return;
}
// If registered with a timer instance, try to upgrade the Arc.
let inner = match entry.upgrade_inner() {
Some(inner) => inner,
None => return,
};
let _ = inner.queue(entry);
}
pub(crate) fn poll_elapsed(&self, cx: &mut task::Context<'... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | e3261440e56ebf576790e4c6f7f125a6c8759659 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3261440e56ebf576790e4c6f7f125a6c8759659/tokio/src/timer/timer/entry.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:9 | if !entry.is_registered() {
return;
}
let inner = match entry.upgrade_inner() {
Some(inner) => inner,
None => return,
};
let deadline = entry.time_ref().deadline;
let when = inner.normalize_deadline(deadline);
let elapsed = inner.elap... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | e3261440e56ebf576790e4c6f7f125a6c8759659 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3261440e56ebf576790e4c6f7f125a6c8759659/tokio/src/timer/timer/entry.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:10 | curr = actual;
}
if notify {
let _ = inner.queue(entry);
}
}
fn upgrade_inner(&self) -> Option<Arc<Inner>> {
self.inner.as_ref().and_then(|inner| inner.upgrade())
}
}
fn is_elapsed(state: u64) -> bool {
state & ELAPSED == ELAPSED
}
impl Drop for Entry {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | e3261440e56ebf576790e4c6f7f125a6c8759659 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3261440e56ebf576790e4c6f7f125a6c8759659/tokio/src/timer/timer/entry.rs | 361 | 396 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:1 | use crate::sync::AtomicWaker;
use crate::timer::atomic::AtomicU64;
use crate::timer::timer::{HandlePriv, Inner};
use crate::timer::Error;
use crossbeam_utils::CachePadded;
use std::cell::UnsafeCell;
use std::ptr;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering::{Relaxed, SeqCst};
use std::sync::{Arc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/timer/timer/entry.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:2 | /// * A flag indicating if the entry has already been fired.
/// * Whether or not the entry transitioned to the error state.
///
/// When an `Entry` is created, `state` is initialized to the instant at
/// which the entry must be fired. When a timer is reset to a different
/// instant, this value is... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/timer/timer/entry.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:3 | /// This is only accessed by the timer
pub(super) next_stack: UnsafeCell<Option<Arc<Entry>>>,
/// Previous entry in the State's linked list.
///
/// This is only accessed by the timer and is used to unlink a canceled
/// entry.
///
/// This is a weak reference.
pub(super) prev_stack: Un... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/timer/timer/entry.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:4 | }
/// Only called by `Registration`
pub(crate) fn time_ref(&self) -> &Time {
unsafe { &*self.time.get() }
}
/// Only called by `Registration`
#[allow(clippy::mut_from_ref)] // https://github.com/rust-lang/rust-clippy/issues/4281
pub(crate) unsafe fn time_mut(&self) -> &mut Time {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/timer/timer/entry.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:5 | let inner = match handle.inner() {
Some(inner) => inner,
None => {
// Could not associate the entry with a timer, transition the
// state to error
Arc::get_mut(me).unwrap().transition_to_error();
return;
}
};
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/timer/timer/entry.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:6 | self.inner = Some(Weak::new());
self.state = AtomicU64::new(ERROR);
}
/// The current entry state as known by the timer. This is not the value of
/// `state`, but lets the timer know how to converge its state to `state`.
pub(crate) fn when_internal(&self) -> Option<u64> {
unsafe { (*sel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/timer/timer/entry.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:7 | let next = ELAPSED | curr;
let actual = self.state.compare_and_swap(curr, next, SeqCst);
if curr == actual {
break;
}
curr = actual;
}
self.waker.wake();
}
pub(crate) fn error(&self) {
// Only transition to the error sta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/timer/timer/entry.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:8 | // Nothing more to do
return;
}
// If registered with a timer instance, try to upgrade the Arc.
let inner = match entry.upgrade_inner() {
Some(inner) => inner,
None => return,
};
let _ = inner.queue(entry);
}
pub(crate) fn poll_elaps... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/timer/timer/entry.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:9 | pub(crate) fn reset(entry: &mut Arc<Entry>) {
if !entry.is_registered() {
return;
}
let inner = match entry.upgrade_inner() {
Some(inner) => inner,
None => return,
};
let deadline = entry.time_ref().deadline;
let when = inner.normaliz... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/timer/timer/entry.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/timer/timer/entry.rs:10 | }
curr = actual;
}
if notify {
let _ = inner.queue(entry);
}
}
fn upgrade_inner(&self) -> Option<Arc<Inner>> {
self.inner.as_ref().and_then(|inner| inner.upgrade())
}
}
fn is_elapsed(state: u64) -> bool {
state & ELAPSED == ELAPSED
}
impl Drop... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/entry.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/timer/timer/entry.rs | 361 | 392 |
tokio-rs/tokio:tokio/src/timer/timer/handle.rs:1 | use crate::timer::clock::now;
use crate::timer::timer::Inner;
use crate::timer::{Delay, Error, Timeout};
use std::cell::RefCell;
use std::fmt;
use std::marker::PhantomData;
use std::sync::{Arc, Weak};
use std::time::{Duration, Instant};
/// Handle to timer instance.
///
/// The `Handle` allows creating `Delay` instan... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/handle.rs | MIT | 742d89b0f333150f6a550ae7840235851f4eb069 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/742d89b0f333150f6a550ae7840235851f4eb069/tokio/src/timer/timer/handle.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/timer/timer/handle.rs:2 | /// Like `Handle` but never `None`.
#[derive(Clone)]
pub(crate) struct HandlePriv {
inner: Weak<Inner>,
}
thread_local! {
/// Tracks the timer for the current execution context.
static CURRENT_TIMER: RefCell<Option<HandlePriv>> = RefCell::new(None)
}
#[derive(Debug)]
///Unsets default timer handler on dro... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/handle.rs | MIT | 742d89b0f333150f6a550ae7840235851f4eb069 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/742d89b0f333150f6a550ae7840235851f4eb069/tokio/src/timer/timer/handle.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/timer/timer/handle.rs:3 | let handle = handle
.as_priv()
.unwrap_or_else(|| panic!("`handle` does not reference a timer"));
*current = Some(handle.clone());
});
DefaultGuard {
_lifetime: PhantomData,
}
}
impl Handle {
pub(crate) fn new(inner: Weak<Inner>) -> Handle {
let inner =... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/handle.rs | MIT | 742d89b0f333150f6a550ae7840235851f4eb069 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/742d89b0f333150f6a550ae7840235851f4eb069/tokio/src/timer/timer/handle.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/timer/timer/handle.rs:4 | }
/// Create a `Delay` driven by this handle's associated `Timer`.
pub fn delay(&self, deadline: Instant) -> Delay {
self.delay_timeout(deadline, Duration::from_secs(0))
}
fn delay_timeout(&self, deadline: Instant, duration: Duration) -> Delay {
match self.inner {
Some(ref ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/handle.rs | MIT | 742d89b0f333150f6a550ae7840235851f4eb069 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/742d89b0f333150f6a550ae7840235851f4eb069/tokio/src/timer/timer/handle.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:1 | //! Timer implementation.
//!
//! This module contains the types needed to run a timer.
//!
//! The [`Timer`] type runs the timer logic. It holds all the necessary state
//! to track all associated [`Delay`] instances and delivering notifications
//! once the deadlines are reached.
//!
//! The [`Handle`] type is a refe... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/timer/timer/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:4 | pub struct Timer<T> {
/// Shared state
inner: Arc<Inner>,
/// Timer wheel
wheel: wheel::Wheel<Stack>,
/// Thread parker. The `Timer` park implementation delegates to this.
park: T,
/// Source of "now" instances
clock: Clock,
}
/// Return value from the `turn` method on `Timer`.
///
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/timer/timer/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:5 | const MAX_TIMEOUTS: usize = usize::MAX >> 1;
// ===== impl Timer =====
impl<T> Timer<T>
where
T: Park,
{
/// Create a new `Timer` instance that uses `park` to block the current
/// thread.
///
/// Once the timer has been created, a handle can be obtained using
/// [`handle`]. The handle is use... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/timer/timer/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:6 | /// thread and `now` to get the current `Instant`.
///
/// Specifying the source of time is useful when testing.
pub fn new_with_clock(park: T, clock: Clock) -> Self {
let unpark = Box::new(park.unpark());
Timer {
inner: Arc::new(Inner::new(clock.now(), unpark)),
whe... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/timer/timer/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:7 | /// error.
///
/// [`new`]: #method.new
pub fn turn(&mut self, max_wait: Option<Duration>) -> Result<Turn, T::Error> {
match max_wait {
Some(timeout) => self.park_timeout(timeout)?,
None => self.park()?,
}
Ok(Turn(()))
}
/// Converts an `Expiration` ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/timer/timer/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:8 | ///
/// This handles adding and canceling timeouts.
fn process_queue(&mut self) {
for entry in self.inner.process.take() {
match (entry.when_internal(), entry.load_state()) {
(None, None) => {
// Nothing to do
}
(Some(_), No... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/timer/timer/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:9 | // The entry's deadline has elapsed, so fire it and update the
// internal state accordingly.
entry.set_when_internal(None);
entry.fire(when);
}
Err((entry, InsertError::Invalid)) => {
// The entry's deadline is invalid, so error it... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/timer/timer/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:10 | None => {
self.park.park()?;
}
}
self.process();
Ok(())
}
fn park_timeout(&mut self, duration: Duration) -> Result<(), Self::Error> {
self.process_queue();
match self.wheel.poll_at() {
Some(when) => {
let now = s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/timer/timer/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:11 | // from being pushed.
self.inner.process.shutdown();
// 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();
}
}
}
// ===== impl Inn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/timer/timer/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:12 | if curr == actual {
return Ok(());
}
curr = actual;
}
}
/// Decrement the number of active timeouts
fn decrement(&self) {
let prev = self.num.fetch_sub(1, SeqCst);
debug_assert!(prev <= MAX_TIMEOUTS);
}
fn queue(&self, entry: &Arc<En... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/timer/timer/mod.rs | 441 | 477 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:1 | //! Timer implementation.
//!
//! This module contains the types needed to run a timer.
//!
//! The [`Timer`] type runs the timer logic. It holds all the necessary state
//! to track all associated [`Delay`] instances and delivering notifications
//! once the deadlines are reached.
//!
//! The [`Handle`] type is a refe... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | 94f9b04b066cfc3da5c3ee2c961c21a9496135dd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94f9b04b066cfc3da5c3ee2c961c21a9496135dd/tokio/src/timer/timer/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:1 | //! Timer implementation.
//!
//! This module contains the types needed to run a timer.
//!
//! The [`Timer`] type runs the timer logic. It holds all the necessary state
//! to track all associated [`Delay`] instances and delivering notifications
//! once the deadlines are reached.
//!
//! The [`Handle`] type is a refe... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/src/timer/timer/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:8 | ///
/// This handles adding and canceling timeouts.
fn process_queue(&mut self) {
for entry in self.inner.process.take() {
match (entry.when_internal(), entry.load_state()) {
(None, None) => {
// Nothing to do
}
(Some(_), No... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/src/timer/timer/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:9 | // The entry's deadline has elapsed, so fire it and update the
// internal state accordingly.
entry.set_when_internal(None);
entry.fire(when);
}
Err((entry, InsertError::Invalid)) => {
// The entry's deadline is invalid, so error it... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/src/timer/timer/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:10 | if deadline > now {
self.park.park_timeout(deadline - now)?;
} else {
self.park.park_timeout(Duration::from_secs(0))?;
}
}
None => {
self.park.park()?;
}
}
self.process();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/src/timer/timer/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:11 | impl<T> Drop for Timer<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 to drain everything
let mut poll ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/src/timer/timer/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/timer/timer/mod.rs:12 | if curr == MAX_TIMEOUTS {
return Err(Error::at_capacity());
}
let actual = self.num.compare_and_swap(curr, curr + 1, SeqCst);
if curr == actual {
return Ok(());
}
curr = actual;
}
}
/// Decrement the number o... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/timer/mod.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/src/timer/timer/mod.rs | 441 | 483 |
tokio-rs/tokio:tokio/src/timer/wheel/level.rs:1 | use crate::timer::wheel::Stack;
use std::fmt;
/// Wheel for a single level in the timer. This wheel contains 64 slots.
pub(crate) struct Level<T> {
level: usize,
/// Bit field tracking which slots currently contain entries.
///
/// Using a bit field to track slots that contain entries allows avoiding... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/timer/wheel/level.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/timer/wheel/level.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/timer/wheel/level.rs:5 | fn next_occupied_slot(&self, now: u64) -> Option<usize> {
if self.occupied == 0 {
return None;
}
// Get the slot for now using Maths
let now_slot = (now / slot_range(self.level)) as usize;
let occupied = self.occupied.rotate_right(now_slot as u32);
let zeros ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/timer/wheel/level.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/timer/wheel/level.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/timer/wheel/level.rs:6 | // The bit is currently set
debug_assert!(self.occupied & occupied_bit(slot) != 0);
self.occupied ^= occupied_bit(slot);
}
ret
}
}
impl<T> fmt::Debug for Level<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Level")
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/timer/wheel/level.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/timer/wheel/level.rs | 201 | 255 |
tokio-rs/tokio:tokio/src/timer/wheel/mod.rs:1 | mod level;
pub(crate) use self::level::Expiration;
use self::level::Level;
mod stack;
pub(crate) use self::stack::Stack;
use std::borrow::Borrow;
use std::usize;
/// Timing wheel implementation.
///
/// This type provides the hashed timing wheel implementation that backs `Timer`
/// and `DelayQueue`.
///
/// The str... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/wheel/mod.rs | MIT | 0da23aad772afb22db8edf73ac0f034c5ada3bde | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0da23aad772afb22db8edf73ac0f034c5ada3bde/tokio/src/timer/wheel/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/timer/wheel/mod.rs:2 | /// each, the timer is able to track time up to 2 years into the future with a
/// precision of 1 millisecond.
const NUM_LEVELS: usize = 6;
/// The maximum duration of a delay
const MAX_DURATION: u64 = 1 << (6 * NUM_LEVELS);
#[derive(Debug)]
pub(crate) enum InsertError {
Elapsed,
Invalid,
}
/// Poll expirati... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/wheel/mod.rs | MIT | 0da23aad772afb22db8edf73ac0f034c5ada3bde | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0da23aad772afb22db8edf73ac0f034c5ada3bde/tokio/src/timer/wheel/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/timer/wheel/mod.rs:4 | });
Ok(())
}
/// Remove `item` from thee timing wheel.
pub(crate) fn remove(&mut self, item: &T::Borrowed, store: &mut T::Store) {
let when = T::when(item, store);
let level = self.level_for(when);
self.levels[level].remove_entry(when, item, store);
}
/// Instant ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/wheel/mod.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/timer/wheel/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/timer/wheel/mod.rs:5 | return None;
}
}
poll.expiration = None;
}
}
/// Returns the instant at which the next timeout expires.
fn next_expiration(&self) -> Option<Expiration> {
// Check all levels
for level in 0..NUM_LEVELS {
if let Some(expiration) = s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/wheel/mod.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/timer/wheel/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/timer/wheel/mod.rs:6 | ) -> Option<T::Owned> {
while let Some(item) = self.pop_entry(expiration, store) {
if expiration.level == 0 {
debug_assert_eq!(T::when(item.borrow(), store), expiration.deadline);
return Some(item);
} else {
let when = T::when(item.borrow(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/timer/wheel/mod.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/timer/wheel/mod.rs | 201 | 260 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.