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/runtime/time/wheel/mod.rs:4
self.pending.remove(item); } else { debug_assert!( self.elapsed <= when, "elapsed={}; when={}", self.elapsed, when ); let level = self.level_for(when); self.levels...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/time/wheel/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:5
} } } self.pending.pop_back() } /// Returns the instant at which the next timeout expires. fn next_expiration(&self) -> Option<Expiration> { if !self.pending.is_empty() { // Expire immediately as we have things pending firing return Some(Expirati...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/time/wheel/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:6
let mut res = true; for level in &self.levels[start_level..] { if let Some(e2) = level.next_expiration(self.elapsed) { if e2.deadline < before { res = false; } } } res } /// iteratively find entries that are b...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/time/wheel/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:7
self.pending.push_front(item); } Err(expiration_tick) => { let level = level_for(expiration.deadline, expiration_tick); unsafe { self.levels[level].add_entry(item); } } } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/time/wheel/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:8
let mut masked = elapsed ^ when | SLOT_MASK; if masked >= MAX_DURATION { // Fudge the timer into the top level masked = MAX_DURATION - 1; } let leading_zeros = masked.leading_zeros() as usize; let significant = 63 - leading_zeros; significant / NUM_LEVELS } #[cfg(all(test, not(lo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
47210a8e6eeb82b51aa778074fdc4d757b953b8c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/runtime/time/wheel/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:9
if pos > level { 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/runtime/time/wheel/mod.rs
MIT
47210a8e6eeb82b51aa778074fdc4d757b953b8c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/runtime/time/wheel/mod.rs
321
345
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:1
use crate::runtime::time::{TimerHandle, TimerShared}; use crate::time::error::InsertError; use crate::util::linked_list::{self, GuardedLinkedList, LinkedList}; mod level; pub(crate) use self::level::Expiration; use self::level::Level; use std::{array, ptr::NonNull}; use super::entry::MAX_SAFE_MILLIS_DURATION; use su...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
8480a180e6ffdd0ec0ec213a9bebcda2445fc541
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/mod.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:2
handle: &'a Handle, ) -> Self { let list = unguarded_list.into_guarded(guard_handle); Self { list, is_empty: false, wheel_id, handle, } } /// Removes the last element from the guarded list. Modifying this list /// requires an exclu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
8480a180e6ffdd0ec0ec213a9bebcda2445fc541
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/mod.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:3
/// Timer wheel. /// /// Levels: /// /// * 1 ms slots / 64 ms range /// * 64 ms slots / ~ 4 sec range /// * ~ 4 sec slots / ~ 4 min range /// * ~ 4 min slots / ~ 4 hr range /// * ~ 4 hr slots / ~ 12 day range /// * ~ 12 day slots / ~ 2 yr range levels: Box<[Level; NUM_LEVELS]>, }...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
8480a180e6ffdd0ec0ec213a9bebcda2445fc541
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:4
/// /// # Arguments /// /// * `item`: The item to insert into the wheel. /// /// # Return /// /// 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, th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
8480a180e6ffdd0ec0ec213a9bebcda2445fc541
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:5
}); Ok(when) } /// Removes `item` from the timing wheel. pub(crate) unsafe fn remove(&mut self, item: NonNull<TimerShared>) { unsafe { let when = item.as_ref().true_when(); if when <= MAX_SAFE_MILLIS_DURATION { debug_assert!( self...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
8480a180e6ffdd0ec0ec213a9bebcda2445fc541
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:6
Some(expiration) if expiration.deadline <= now => Some(expiration), _ => { // in this case the poll did not indicate an expiration // _and_ we were not able to find a next expiration in // the current list of timers. advance to the poll's // c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
8480a180e6ffdd0ec0ec213a9bebcda2445fc541
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:7
if e2.deadline < before { res = false; } } } res } pub(super) fn set_elapsed(&mut self, when: u64) { assert!( self.elapsed <= when, "elapsed={:?}; when={:?}", self.elapsed, when ); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
8480a180e6ffdd0ec0ec213a9bebcda2445fc541
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:8
// those entries again or we'll end up in an infinite loop. let unguarded_list = self.levels[expiration.level].take_slot(expiration.slot); EntryWaitersList::new(unguarded_list, guard_handle, wheel_id, handle) } pub(super) fn occupied_bit_maintain(&mut self, expiration: &Expiration) { se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
8480a180e6ffdd0ec0ec213a9bebcda2445fc541
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:9
0, level_for(0, pos), "level_for({}) -- binary = {:b}", pos, pos ); } for level in 1..5 { for pos in level..64 { let a = pos * 64_usize.pow(level as u32); assert_eq!( ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
8480a180e6ffdd0ec0ec213a9bebcda2445fc541
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/mod.rs
321
364
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:1
use crate::runtime::time::{TimerHandle, TimerShared}; use crate::time::error::InsertError; mod level; pub(crate) use self::level::Expiration; use self::level::Level; use std::ptr::NonNull; use super::EntryList; /// Timing wheel implementation. /// /// This type provides the hashed timing wheel implementation that b...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
1cb7bf11b307b348b62f99b2f18926b0de968384
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1cb7bf11b307b348b62f99b2f18926b0de968384/tokio/src/runtime/time/wheel/mod.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:2
pending: EntryList, } /// 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`. pub(super) const MAX_DURATION: u64 = (...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
1cb7bf11b307b348b62f99b2f18926b0de968384
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1cb7bf11b307b348b62f99b2f18926b0de968384/tokio/src/runtime/time/wheel/mod.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:3
/// already passed. In this case, the caller should fire the timeout /// immediately. /// /// `Err(Invalid)` indicates an invalid `when` argument as been supplied. /// /// # Safety /// /// This function registers item into an intrusive linked list. The caller /// must ensure that `item` ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
1cb7bf11b307b348b62f99b2f18926b0de968384
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1cb7bf11b307b348b62f99b2f18926b0de968384/tokio/src/runtime/time/wheel/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:4
let when = item.as_ref().cached_when(); if when == u64::MAX { self.pending.remove(item); } else { debug_assert!( self.elapsed <= when, "elapsed={}; when={}", self.elapsed, when ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
1cb7bf11b307b348b62f99b2f18926b0de968384
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1cb7bf11b307b348b62f99b2f18926b0de968384/tokio/src/runtime/time/wheel/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:5
// current time and do nothing else. self.set_elapsed(now); break; } } } self.pending.pop_back() } /// Returns the instant at which the next timeout expires. fn next_expiration(&self) -> Option<Expiration> { if !se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
1cb7bf11b307b348b62f99b2f18926b0de968384
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1cb7bf11b307b348b62f99b2f18926b0de968384/tokio/src/runtime/time/wheel/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:6
/// Used for debug assertions fn no_expirations_before(&self, start_level: usize, before: u64) -> bool { let mut res = true; for l2 in start_level..NUM_LEVELS { if let Some(e2) = self.levels[l2].next_expiration(self.elapsed) { if e2.deadline < before { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
1cb7bf11b307b348b62f99b2f18926b0de968384
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1cb7bf11b307b348b62f99b2f18926b0de968384/tokio/src/runtime/time/wheel/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:7
match unsafe { item.mark_pending(expiration.deadline) } { Ok(()) => { // Item was expired self.pending.push_front(item); } Err(expiration_tick) => { let level = level_for(expiration.deadline, expiration_tick); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
1cb7bf11b307b348b62f99b2f18926b0de968384
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1cb7bf11b307b348b62f99b2f18926b0de968384/tokio/src/runtime/time/wheel/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:8
const SLOT_MASK: u64 = (1 << 6) - 1; // Mask in the trailing bits ignored by the level calculation in order to cap // the possible leading zeros let mut masked = elapsed ^ when | SLOT_MASK; if masked >= MAX_DURATION { // Fudge the timer into the top level masked = MAX_DURATION - 1; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
1cb7bf11b307b348b62f99b2f18926b0de968384
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1cb7bf11b307b348b62f99b2f18926b0de968384/tokio/src/runtime/time/wheel/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:9
a, a ); if pos > level { let a = a - 1; assert_eq!( level, level_for(0, a as u64), "level_for({}) -- binary = {:b}", a, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time/wheel/mod.rs
MIT
1cb7bf11b307b348b62f99b2f18926b0de968384
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1cb7bf11b307b348b62f99b2f18926b0de968384/tokio/src/runtime/time/wheel/mod.rs
321
349
tokio-rs/tokio:tokio/src/runtime/time_alt/cancellation_queue.rs:1
use super::{CancellationQueueEntry, Entry, EntryHandle}; use crate::loom::sync::{Arc, Mutex}; use crate::util::linked_list; type EntryList = linked_list::LinkedList<CancellationQueueEntry, Entry>; #[derive(Debug, Default)] struct Inner { list: EntryList, } impl Drop for Inner { fn drop(&mut self) { /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/cancellation_queue.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/cancellation_queue.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/cancellation_queue.rs:2
type Item = EntryHandle; fn next(&mut self) -> Option<Self::Item> { self.0.list.pop_front() } } Iter(self) } } #[derive(Debug, Clone)] pub(crate) struct Sender { inner: Arc<Mutex<Inner>>, } impl Sender { /// # Safety /// /// Behavior is und...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/cancellation_queue.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/cancellation_queue.rs
41
92
tokio-rs/tokio:tokio/src/runtime/time_alt/cancellation_queue.rs:3
pub(crate) fn new() -> (Sender, Receiver) { let inner = Arc::new(Mutex::new(Inner::new())); ( Sender { inner: inner.clone(), }, Receiver { inner }, ) } #[cfg(test)] mod tests;
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/cancellation_queue.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/cancellation_queue.rs
81
92
tokio-rs/tokio:tokio/src/runtime/time_alt/cancellation_queue.rs:1
use super::{CancellationQueueEntry, Entry, EntryHandle}; use crate::loom::sync::{Arc, Mutex}; use crate::util::linked_list; type EntryList = linked_list::LinkedList<CancellationQueueEntry, Entry>; #[derive(Debug)] struct Inner { list: EntryList, } impl Drop for Inner { fn drop(&mut self) { // consume...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/cancellation_queue.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/cancellation_queue.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/cancellation_queue.rs:2
fn drop(&mut self) { while let Some(hdl) = self.list.pop_front() { drop(hdl); } } } impl Iterator for Iter { type Item = EntryHandle; fn next(&mut self) -> Option<Self::Item> { self.list.pop_front()...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/cancellation_queue.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/cancellation_queue.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time_alt/cancellation_queue.rs:3
pub(crate) struct Receiver { inner: Arc<Mutex<Inner>>, } impl Receiver { pub(crate) fn recv_all(&mut self) -> impl Iterator<Item = EntryHandle> { self.inner.lock().iter() } } pub(crate) fn new() -> (Sender, Receiver) { let inner = Arc::new(Mutex::new(Inner::new())); ( Sender { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/cancellation_queue.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/cancellation_queue.rs
81
102
tokio-rs/tokio:tokio/src/runtime/time_alt/cancellation_queue/tests.rs:1
use super::*; use futures::task::noop_waker; #[cfg(loom)] const NUM_ITEMS: usize = 16; #[cfg(not(loom))] const NUM_ITEMS: usize = 64; fn new_handle() -> EntryHandle { EntryHandle::new(0, noop_waker()) } fn model<F: Fn() + Send + Sync + 'static>(f: F) { #[cfg(loom)] loom::model(f); #[cfg(not(loom))...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/cancellation_queue/tests.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/cancellation_queue/tests.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/cancellation_queue/tests.rs:2
use crate::loom::sync::atomic::{AtomicUsize, Ordering::SeqCst}; use crate::loom::sync::Arc; use crate::loom::thread; #[cfg(loom)] const NUM_THREADS: usize = 3; #[cfg(not(loom))] const NUM_THREADS: usize = 8; model(|| { let (tx, mut rx) = new(); let mut jhs = Vec::new(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/cancellation_queue/tests.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/cancellation_queue/tests.rs
41
97
tokio-rs/tokio:tokio/src/runtime/time_alt/cancellation_queue/tests.rs:3
} #[test] fn drop_iter_should_not_leak_memory() { model(|| { let (tx, mut rx) = new(); let hdls = (0..NUM_ITEMS).map(|_| new_handle()).collect::<Vec<_>>(); for hdl in hdls.iter() { unsafe { tx.send(hdl.clone()) }; } drop(rx.recv_all()); assert!(hdls.in...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/cancellation_queue/tests.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/cancellation_queue/tests.rs
81
97
tokio-rs/tokio:tokio/src/runtime/time_alt/context.rs:1
use super::{cancellation_queue, RegistrationQueue, Wheel}; /// Local context for the time driver, used when the runtime wants to /// fire/cancel timers. pub(crate) struct LocalContext { pub(crate) wheel: Wheel, pub(crate) registration_queue: RegistrationQueue, pub(crate) canc_tx: cancellation_queue::Sender...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/context.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/context.rs
1
47
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:1
use super::cancellation_queue::Sender; use crate::loom::sync::{Arc, Mutex}; use crate::util::linked_list; use std::marker::PhantomPinned; use std::ptr::NonNull; use std::task::{Context, Poll, Waker}; pub(super) type EntryList = linked_list::LinkedList<Entry, Entry>; #[derive(Debug)] struct State { cancelled: boo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/entry.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:2
/// /// [`RegistrationQueue`]: super::RegistrationQueue /// [`Wheel`]: super::Wheel /// [`WakeQueue`]: super::WakeQueue extra_pointers: linked_list::Pointers<Entry>, /// The tick when this entry is scheduled to expire. deadline: u64, state: Mutex<State>, /// Make the type `!Unpin` to ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/entry.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:3
} /// An ZST to allow [`super::registration_queue`] to utilize the [`Entry::extra_pointers`] /// by impl [`linked_list::Link`] as we cannot impl it on [`Entry`] /// directly due to the conflicting implementations. /// /// This type should never be constructed. pub(super) struct RegistrationQueueEntry; // Safety: `Ent...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/entry.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:4
// Safety: `Entry` is always in an `Arc`. unsafe impl linked_list::Link for CancellationQueueEntry { type Handle = Handle; type Target = Entry; fn as_raw(hdl: &Self::Handle) -> NonNull<Self::Target> { unsafe { NonNull::new_unchecked(Arc::as_ptr(&hdl.entry).cast_mut()) } } unsafe fn from_ra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/entry.rs
121
180
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:5
unsafe fn from_raw(ptr: NonNull<Self::Target>) -> Self::Handle { Handle { entry: unsafe { Arc::from_raw(ptr.as_ptr()) }, } } unsafe fn pointers( target: NonNull<Self::Target>, ) -> NonNull<linked_list::Pointers<Self::Target>> { let this = target.as_ptr(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/entry.rs
161
220
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:6
state: Mutex::new(state), _pin: PhantomPinned, }); Handle { entry } } /// Wake the entry if it is already in the pending queue of the timer wheel. pub(crate) fn wake(&self) { let mut lock = self.entry.state.lock(); if !lock.cancelled { lock.woken_up...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/entry.rs
201
260
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:7
Some(current_waker) if current_waker.will_wake(cx.waker()) => None, _ => lock.waker.replace(cx.waker().clone()), }; // unlock before dropping waker drop(lock); drop(maybe_old_waker); Poll::Pending } pub(crate) fn cancel(&self) { let mut lock = self.e...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/entry.rs
241
286
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:1
use super::cancellation_queue::Sender; use crate::loom::sync::{Arc, Mutex}; use crate::util::linked_list; use std::marker::PhantomPinned; use std::ptr::NonNull; use std::task::Waker; pub(super) type EntryList = linked_list::LinkedList<Entry, Entry>; #[derive(Debug)] struct State { cancelled: bool, woken_up: ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
0926ab195aa6decebbde71ad080521051c02a8ee
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0926ab195aa6decebbde71ad080521051c02a8ee/tokio/src/runtime/time_alt/entry.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:6
state: Mutex::new(state), _pin: PhantomPinned, }); Handle { entry } } /// Wake the entry if it is already in the pending queue of the timer wheel. pub(crate) fn wake(&self) { let mut lock = self.entry.state.lock(); if !lock.cancelled { lock.woken_up...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
0926ab195aa6decebbde71ad080521051c02a8ee
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0926ab195aa6decebbde71ad080521051c02a8ee/tokio/src/runtime/time_alt/entry.rs
201
260
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:7
drop(lock); drop(maybe_old_waker); } } pub(crate) fn cancel(&self) { let mut lock = self.entry.state.lock(); if !lock.cancelled { lock.cancelled = true; if let Some(cancel_tx) = lock.cancel_tx.take() { drop(lock); // S...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
0926ab195aa6decebbde71ad080521051c02a8ee
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0926ab195aa6decebbde71ad080521051c02a8ee/tokio/src/runtime/time_alt/entry.rs
241
281
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:6
state: Mutex::new(state), _pin: PhantomPinned, }); Handle { entry } } /// Wake the entry if it is already in the pending queue of the timer wheel. pub(crate) fn wake(&self) { let mut lock = self.entry.state.lock(); if !lock.cancelled { lock.woken_up...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/entry.rs
201
260
tokio-rs/tokio:tokio/src/runtime/time_alt/entry.rs:7
pub(crate) fn cancel(&self) { let mut lock = self.entry.state.lock(); if !lock.cancelled { lock.cancelled = true; if let Some(cancel_tx) = lock.cancel_tx.take() { drop(lock); // Safety: we can guarantee that `self` is not in any cancellation queue...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/entry.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/entry.rs
241
276
tokio-rs/tokio:tokio/src/runtime/time_alt/mod.rs:1
pub(crate) mod context; pub(super) use context::{LocalContext, TempLocalContext}; pub(crate) mod cancellation_queue; mod entry; pub(crate) use entry::Handle as EntryHandle; use entry::{CancellationQueueEntry, RegistrationQueueEntry, WakeQueueEntry}; use entry::{Entry, EntryList}; mod registration_queue; pub(crate) u...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/mod.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/mod.rs
1
24
tokio-rs/tokio:tokio/src/runtime/time_alt/registration_queue.rs:1
use super::{Entry, EntryHandle, RegistrationQueueEntry}; use crate::util::linked_list; type EntryList = linked_list::LinkedList<RegistrationQueueEntry, Entry>; /// A queue of entries that need to be registered in the timer wheel. #[derive(Debug)] pub(crate) struct RegistrationQueue { list: EntryList, } impl Drop...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/registration_queue.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/registration_queue.rs
1
43
tokio-rs/tokio:tokio/src/runtime/time_alt/registration_queue/tests.rs:1
use super::*; use futures::task::noop_waker; #[cfg(loom)] const NUM_ITEMS: usize = 16; #[cfg(not(loom))] const NUM_ITEMS: usize = 64; fn new_handle() -> EntryHandle { EntryHandle::new(0, noop_waker()) } fn model<F: Fn() + Send + Sync + 'static>(f: F) { #[cfg(loom)] loom::model(f); #[cfg(not(loom))...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/registration_queue/tests.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/registration_queue/tests.rs
1
53
tokio-rs/tokio:tokio/src/runtime/time_alt/tests.rs:1
use super::*; use crate::loom::thread; use futures_test::task::{new_count_waker, AwokenCount}; #[cfg(loom)] const NUM_ITEMS: usize = 16; #[cfg(not(loom))] const NUM_ITEMS: usize = 64; fn new_handle() -> (EntryHandle, AwokenCount) { let (waker, count) = new_count_waker(); (EntryHandle::new(0, waker), count) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/tests.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/tests.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/tests.rs:2
for _ in 0..NUM_ITEMS { if let Some(hdl) = reg_queue.pop_front() { unsafe { wake_queue.push_front(hdl); } } } assert!(reg_queue.pop_front().is_none()); wake_queue.wake_all(); assert!(counts.into_iter().all(|c| c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/tests.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/tests.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time_alt/tests.rs:3
wake_queue.push_front(hdl); } } wake_queue.wake_all(); assert!(counts.into_iter().all(|c| c.get() == 0)); }); } #[test] fn wake_up_in_the_different_thread() { model(|| { let mut counts = Vec::new(); let mut hdls = Vec::new(); let mut reg_queue = Reg...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/tests.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/tests.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time_alt/tests.rs:4
.join() .unwrap(); }); } #[test] fn cancel_in_the_different_thread() { model(|| { let mut counts = Vec::new(); let (cancel_tx, mut cancel_rx) = cancellation_queue::new(); let mut hdls = Vec::new(); let mut reg_queue = RegistrationQueue::new(); for _ in 0..NUM_IT...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/tests.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/tests.rs
121
168
tokio-rs/tokio:tokio/src/runtime/time_alt/timer.rs:1
use super::{EntryHandle, TempLocalContext}; use crate::runtime::scheduler::Handle as SchedulerHandle; use crate::time::Instant; use std::pin::Pin; use std::task::{Context, Poll}; #[cfg(any(feature = "rt", feature = "rt-multi-thread"))] use crate::util::error::RUNTIME_SHUTTING_DOWN_ERROR; pub(crate) struct Timer { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/timer.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/timer.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/timer.rs:2
#[track_caller] pub(crate) fn new(sched_hdl: SchedulerHandle, deadline: Instant) -> Self { // Panic if the time driver is not enabled let _ = sched_hdl.driver().time(); Timer { sched_handle: sched_hdl, entry: None, deadline, } } pub(crate)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/timer.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/timer.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time_alt/timer.rs:3
Poll::Pending } #[cfg(feature = "rt-multi-thread")] Some(TempLocalContext::Shutdown) => panic!("{RUNTIME_SHUTTING_DOWN_ERROR}"), _ => { let hdl = EntryHandle::new(deadline, cx.waker().clone()); this.entry = Some(hdl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/timer.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/timer.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time_alt/timer.rs:4
{ #[cfg(not(feature = "rt"))] { let (_, _) = (hdl, f); panic!("Tokio runtime is not enabled, cannot access the current wheel"); } #[cfg(feature = "rt")] { use crate::runtime::context; let is_same_rt = context::with_current(|cur_hdl| cur_hdl.is_same_runti...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/timer.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/timer.rs
121
165
tokio-rs/tokio:tokio/src/runtime/time_alt/timer.rs:2
#[track_caller] pub(crate) fn new(sched_hdl: SchedulerHandle, deadline: Instant) -> Self { // Panic if the time driver is not enabled let _ = sched_hdl.driver().time(); Timer { sched_handle: sched_hdl, entry: None, deadline, } } pub(crate)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/timer.rs
MIT
0926ab195aa6decebbde71ad080521051c02a8ee
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0926ab195aa6decebbde71ad080521051c02a8ee/tokio/src/runtime/time_alt/timer.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time_alt/timer.rs:3
Poll::Pending } #[cfg(feature = "rt-multi-thread")] Some(TempLocalContext::Shutdown) => panic!("{RUNTIME_SHUTTING_DOWN_ERROR}"), _ => { let hdl = EntryHandle::new(deadline, cx.waker().clone()); this.entry = Some(hdl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/timer.rs
MIT
0926ab195aa6decebbde71ad080521051c02a8ee
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0926ab195aa6decebbde71ad080521051c02a8ee/tokio/src/runtime/time_alt/timer.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time_alt/timer.rs:4
fn with_current_temp_local_context<F, R>(hdl: &SchedulerHandle, f: F) -> R where F: FnOnce(Option<TempLocalContext<'_>>) -> R, { #[cfg(not(feature = "rt"))] { let (_, _) = (hdl, f); panic!("Tokio runtime is not enabled, cannot access the current wheel"); } #[cfg(feature = "rt")] ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/timer.rs
MIT
0926ab195aa6decebbde71ad080521051c02a8ee
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0926ab195aa6decebbde71ad080521051c02a8ee/tokio/src/runtime/time_alt/timer.rs
121
169
tokio-rs/tokio:tokio/src/runtime/time_alt/timer.rs:2
#[track_caller] pub(crate) fn new(sched_hdl: SchedulerHandle, deadline: Instant) -> Self { // Panic if the time driver is not enabled let _ = sched_hdl.driver().time(); Timer { sched_handle: sched_hdl, entry: None, deadline, } } pub(crate)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/timer.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/timer.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time_alt/timer.rs:3
Poll::Pending } #[cfg(feature = "rt-multi-thread")] Some(TempLocalContext::Shutdown) => panic!("{RUNTIME_SHUTTING_DOWN_ERROR}"), _ => { let hdl = EntryHandle::new(deadline, cx.waker().clone()); this.entry = Some(hdl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/timer.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/timer.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time_alt/wake_queue.rs:1
use super::{Entry, EntryHandle, WakeQueueEntry}; use crate::util::linked_list; type EntryList = linked_list::LinkedList<WakeQueueEntry, Entry>; /// A queue of entries that need to be woken up. #[derive(Debug)] pub(crate) struct WakeQueue { list: EntryList, } impl Drop for WakeQueue { fn drop(&mut self) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wake_queue.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wake_queue.rs
1
50
tokio-rs/tokio:tokio/src/runtime/time_alt/wake_queue/tests.rs:1
use super::*; use futures_test::task::{new_count_waker, AwokenCount}; #[cfg(loom)] const NUM_ITEMS: usize = 16; #[cfg(not(loom))] const NUM_ITEMS: usize = 64; fn new_handle() -> (EntryHandle, AwokenCount) { let (waker, count) = new_count_waker(); (EntryHandle::new(0, waker), count) } fn model<F: Fn() + Sen...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wake_queue/tests.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wake_queue/tests.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/wake_queue/tests.rs:2
} #[test] fn drop_should_not_leak_memory() { model(|| { let mut queue = WakeQueue::new(); let mut hdls = vec![]; let mut counts = vec![]; for _ in 0..NUM_ITEMS { let (hdl, count) = new_handle(); hdls.push(hdl); counts.push(count); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wake_queue/tests.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wake_queue/tests.rs
41
66
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/level.rs:1
use super::{EntryHandle, EntryList}; use std::ptr::NonNull; use std::{array, 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 tha...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/level.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wheel/level.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/level.rs:3
// pseudo-ring buffer, and we rotate around them indefinitely. If we // compute a deadline before now, and it's the top level, it // therefore means we're actually looking at a slot in the future. debug_assert_eq!(self.level, super::NUM_LEVELS - 1); deadline += level_ran...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/level.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wheel/level.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/level.rs:4
pub(crate) unsafe fn add_entry(&mut self, hdl: EntryHandle) { // Safety: the associated entry must be valid. let deadline = hdl.deadline(); let slot = slot_for(deadline, self.level); self.slot[slot].push_front(hdl); self.occupied |= occupied_bit(slot); } pub(crate) uns...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/level.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wheel/level.rs
121
180
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/level.rs:5
1 << slot } fn slot_range(level: usize) -> u64 { LEVEL_MULT.pow(level as u32) as u64 } fn level_range(level: usize) -> u64 { LEVEL_MULT as u64 * slot_range(level) } /// Converts a duration (milliseconds) and a level to a slot position. fn slot_for(duration: u64, level: usize) -> usize { ((duration >> (le...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/level.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wheel/level.rs
161
194
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:1
mod level; pub(crate) use self::level::Expiration; use self::level::Level; use super::cancellation_queue::Sender; use super::{EntryHandle, EntryList, WakeQueue}; /// Hashed timing wheel implementation. /// /// See [`Driver`] documentation for some implementation notes. /// /// [`Driver`]: crate::runtime::time::Driver...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wheel/mod.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:2
pub(crate) fn new() -> Wheel { let levels = (0..NUM_LEVELS).map(Level::new).collect::<Box<_>>(); Wheel { elapsed: 0, levels: levels.try_into().unwrap(), } } /// Returns the number of milliseconds that have elapsed since the timing /// wheel's creation. pu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wheel/mod.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:3
.next_expiration(self.elapsed) .map(|e| e.deadline >= self.elapsed) .unwrap_or(true) }); } /// Removes `item` from the timing wheel. /// /// # Safety /// /// The caller must ensure: /// /// * The entry is already registered in THIS wheel. pub(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wheel/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:4
fn next_expiration(&self) -> Option<Expiration> { // Check all levels self.levels .iter() .enumerate() .find_map(|(level_num, level)| { let expiration = level.next_expiration(self.elapsed)?; // There cannot be any expirations at a highe...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wheel/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:5
// those entries might need to be reinserted into the same slot. // // This happens only on the highest level, when an entry is inserted // more than MAX_DURATION into the future. When this happens, we wrap // around, and process some entries a multiple of MAX_DURATION before // ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wheel/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:6
} } /// Obtains the list of entries that need processing for the given expiration. fn take_entries(&mut self, expiration: &Expiration) -> EntryList { self.levels[expiration.level].take_slot(expiration.slot) } fn level_for(&self, when: u64) -> usize { level_for(self.elapsed, when) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wheel/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:7
for level in 1..5 { for pos in level..64 { let a = pos * 64_usize.pow(level as u32); assert_eq!( level, level_for(0, a as u64), "level_for({a}) -- binary = {a:b}" ); if pos > level { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time_alt/wheel/mod.rs
241
271
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:1
mod level; pub(crate) use self::level::Expiration; use self::level::Level; use super::cancellation_queue::Sender; use super::{EntryHandle, EntryList, WakeQueue}; /// Hashed timing wheel implementation. /// /// See [`Driver`] documentation for some implementation notes. /// /// [`Driver`]: crate::runtime::time::Driver...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
8f81e0814bd121683ebdfa21b494d1b77fb36403
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time_alt/wheel/mod.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:2
pub(crate) fn new() -> Wheel { let mut levels = Vec::with_capacity(NUM_LEVELS); for i in 0..NUM_LEVELS { levels.push(Level::new(i)); } Wheel { elapsed: 0, levels: levels.into_boxed_slice().try_into().unwrap(), } } /// Returns the numbe...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
8f81e0814bd121683ebdfa21b494d1b77fb36403
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time_alt/wheel/mod.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:3
debug_assert!({ self.levels[level] .next_expiration(self.elapsed) .map(|e| e.deadline >= self.elapsed) .unwrap_or(true) }); } /// Removes `item` from the timing wheel. /// /// # Safety /// /// The caller must ensure: /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
8f81e0814bd121683ebdfa21b494d1b77fb36403
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time_alt/wheel/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:4
} /// Returns the instant at which the next timeout expires. fn next_expiration(&self) -> Option<Expiration> { // Check all levels self.levels .iter() .enumerate() .find_map(|(level_num, level)| { let expiration = level.next_expiration(self.el...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
8f81e0814bd121683ebdfa21b494d1b77fb36403
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time_alt/wheel/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:5
) { // Note that we need to take _all_ of the entries off the list before // processing any of them. This is important because it's possible that // those entries might need to be reinserted into the same slot. // // This happens only on the highest level, when an entry is insert...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
8f81e0814bd121683ebdfa21b494d1b77fb36403
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time_alt/wheel/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:6
if when > self.elapsed { self.elapsed = when; } } /// Obtains the list of entries that need processing for the given expiration. fn take_entries(&mut self, expiration: &Expiration) -> EntryList { self.levels[expiration.level].take_slot(expiration.slot) } fn level_for(&s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
8f81e0814bd121683ebdfa21b494d1b77fb36403
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time_alt/wheel/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:7
for pos in 0..64 { assert_eq!(0, level_for(0, pos), "level_for({pos}) -- binary = {pos:b}"); } for level in 1..5 { for pos in level..64 { let a = pos * 64_usize.pow(level as u32); assert_eq!( level, level_fo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
8f81e0814bd121683ebdfa21b494d1b77fb36403
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time_alt/wheel/mod.rs
241
274
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:1
mod level; pub(crate) use self::level::Expiration; use self::level::Level; use super::cancellation_queue::Sender; use super::{EntryHandle, EntryList, WakeQueue}; use std::array; /// Hashed timing wheel implementation. /// /// See [`Driver`] documentation for some implementation notes. /// /// [`Driver`]: crate::runt...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
0a3e3862697d902cffd729506cb28f6007c204d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0a3e3862697d902cffd729506cb28f6007c204d1/tokio/src/runtime/time_alt/wheel/mod.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:2
impl Wheel { /// Creates a new timing wheel. pub(crate) fn new() -> Wheel { Wheel { elapsed: 0, levels: Box::new(array::from_fn(Level::new)), } } /// Returns the number of milliseconds that have elapsed since the timing /// wheel's creation. pub(crate) fn...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
0a3e3862697d902cffd729506cb28f6007c204d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0a3e3862697d902cffd729506cb28f6007c204d1/tokio/src/runtime/time_alt/wheel/mod.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:3
self.levels[level] .next_expiration(self.elapsed) .map(|e| e.deadline >= self.elapsed) .unwrap_or(true) }); } /// Removes `item` from the timing wheel. /// /// # Safety /// /// The caller must ensure: /// /// * The entry is already...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
0a3e3862697d902cffd729506cb28f6007c204d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0a3e3862697d902cffd729506cb28f6007c204d1/tokio/src/runtime/time_alt/wheel/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:4
/// Returns the instant at which the next timeout expires. fn next_expiration(&self) -> Option<Expiration> { // Check all levels self.levels .iter() .enumerate() .find_map(|(level_num, level)| { let expiration = level.next_expiration(self.elapsed)?...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
0a3e3862697d902cffd729506cb28f6007c204d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0a3e3862697d902cffd729506cb28f6007c204d1/tokio/src/runtime/time_alt/wheel/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:5
// processing any of them. This is important because it's possible that // those entries might need to be reinserted into the same slot. // // This happens only on the highest level, when an entry is inserted // more than MAX_DURATION into the future. When this happens, we wrap /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
0a3e3862697d902cffd729506cb28f6007c204d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0a3e3862697d902cffd729506cb28f6007c204d1/tokio/src/runtime/time_alt/wheel/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:6
self.elapsed = when; } } /// Obtains the list of entries that need processing for the given expiration. fn take_entries(&mut self, expiration: &Expiration) -> EntryList { self.levels[expiration.level].take_slot(expiration.slot) } fn level_for(&self, when: u64) -> usize { le...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
0a3e3862697d902cffd729506cb28f6007c204d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0a3e3862697d902cffd729506cb28f6007c204d1/tokio/src/runtime/time_alt/wheel/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:7
} for level in 1..5 { for pos in level..64 { let a = pos * 64_usize.pow(level as u32); assert_eq!( level, level_for(0, a as u64), "level_for({a}) -- binary = {a:b}" ); if pos...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
0a3e3862697d902cffd729506cb28f6007c204d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0a3e3862697d902cffd729506cb28f6007c204d1/tokio/src/runtime/time_alt/wheel/mod.rs
241
272
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:3
self.levels[level] .next_expiration(self.elapsed) .map(|e| e.deadline >= self.elapsed) .unwrap_or(true) }); } /// Removes `item` from the timing wheel. /// /// # Safety /// /// The caller must ensure: /// /// * The entry is already...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time_alt/wheel/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:4
// current time and do nothing else. self.set_elapsed(now); break; } } } } /// Returns the instant at which the next timeout expires. fn next_expiration(&self) -> Option<Expiration> { // Check all levels for (level_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time_alt/wheel/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:5
} res } /// iteratively find entries that are between the wheel's current /// time and the expiration time. for each in that population either /// queue it for notification (in the case of the last level) or tier /// it down to the next level (in all other cases). pub(crate) fn proces...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time_alt/wheel/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:6
wake_queue.push_front(hdl); } } } } fn set_elapsed(&mut self, when: u64) { assert!( self.elapsed <= when, "elapsed={:?}; when={:?}", self.elapsed, when ); if when > self.elapsed { self.elaps...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time_alt/wheel/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:7
let leading_zeros = masked.leading_zeros() as usize; let significant = 63 - leading_zeros; significant / NUM_LEVELS } #[cfg(all(test, not(loom)))] mod test { use super::*; #[test] fn test_level_for() { for pos in 0..64 { assert_eq!(0, level_for(0, pos), "level_for({pos}) -- bi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time_alt/wheel/mod.rs
241
287
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:1
mod level; pub(crate) use self::level::Expiration; use self::level::Level; use super::cancellation_queue::Sender; use super::{EntryHandle, EntryList, WakeQueue}; use std::array; /// Timing wheel implementation. /// /// This type provides the hashed timing wheel implementation that backs `Timer` /// and `DelayQueue`....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/wheel/mod.rs
1
60
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:2
/// precision of 1 millisecond. const NUM_LEVELS: usize = 6; /// The maximum duration of a `Sleep`. pub(super) const MAX_DURATION: u64 = (1 << (6 * NUM_LEVELS)) - 1; impl Wheel { /// Creates a new timing wheel. pub(crate) fn new() -> Wheel { Wheel { elapsed: 0, levels: Box::new...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/wheel/mod.rs
41
100
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:3
let level = self.level_for(deadline); unsafe { self.levels[level].add_entry(hdl); } debug_assert!({ self.levels[level] .next_expiration(self.elapsed) .map(|e| e.deadline >= self.elapsed) .unwrap_or(true) }); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/wheel/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:4
self.set_elapsed(expiration.deadline); } _ => { // in this case the poll did not indicate an expiration // _and_ we were not able to find a next expiration in // the current list of timers. advance to the poll's ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/wheel/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/time_alt/wheel/mod.rs:5
for level in &self.levels[start_level..] { if let Some(e2) = level.next_expiration(self.elapsed) { if e2.deadline < before { res = false; } } } res } /// iteratively find entries that are between the wheel's current ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/time_alt/wheel/mod.rs
MIT
73d733a3415af98d72c2cce40612c4e59adbd5d8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/time_alt/wheel/mod.rs
161
220