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/tests/mod.rs:5 | .as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
entry.as_mut().reset(start + Duration::from_secs(2));
// shouldn't complete before 2s
block_on(futures::future::poll_fn(|cx| {
entry.as_mut().poll_elapsed(cx)
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 7483509746e1d82d7fc3642fd8431116c96aa387 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7483509746e1d82d7fc3642fd8431116c96aa387/tokio/src/runtime/time/tests/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:6 | fn normal_or_miri<T>(normal: T, miri: T) -> T {
if cfg!(miri) {
miri
} else {
normal
}
}
#[test]
#[cfg(not(loom))]
fn poll_process_levels() {
let rt = rt(true);
let handle = rt.handle();
let mut entries = vec![];
for i in 0..normal_or_miri(1024, 64) {
let mut entry... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 7483509746e1d82d7fc3642fd8431116c96aa387 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7483509746e1d82d7fc3642fd8431116c96aa387/tokio/src/runtime/time/tests/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:7 | }
}
#[test]
#[cfg(not(loom))]
fn poll_process_levels_targeted() {
let mut context = Context::from_waker(noop_waker_ref());
let rt = rt(true);
let handle = rt.handle();
let e1 = TimerEntry::new(
&handle.inner,
handle.inner.driver().clock().now() + Duration::from_millis(193),
);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 7483509746e1d82d7fc3642fd8431116c96aa387 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7483509746e1d82d7fc3642fd8431116c96aa387/tokio/src/runtime/time/tests/mod.rs | 241 | 264 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:1 | #![cfg(not(tokio_wasi))]
use std::{task::Context, time::Duration};
#[cfg(not(loom))]
use futures::task::noop_waker_ref;
use crate::loom::sync::atomic::{AtomicBool, Ordering};
use crate::loom::sync::Arc;
use crate::loom::thread;
use super::TimerEntry;
fn block_on<T>(f: impl std::future::Future<Output = T>) -> T {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | ebeb78ed40027032feb77c89a1de4b58d2dcafbf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebeb78ed40027032feb77c89a1de4b58d2dcafbf/tokio/src/runtime/time/tests/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:2 | }
#[test]
fn single_timer() {
model(|| {
let rt = rt(false);
let handle = rt.handle();
let handle_ = handle.clone();
let jh = thread::spawn(move || {
let entry = TimerEntry::new(
&handle_.inner,
handle_.inner.clock().now() + Duration::fro... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | ebeb78ed40027032feb77c89a1de4b58d2dcafbf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebeb78ed40027032feb77c89a1de4b58d2dcafbf/tokio/src/runtime/time/tests/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:3 | let handle_ = handle.clone();
let jh = thread::spawn(move || {
let entry = TimerEntry::new(
&handle_.inner,
handle_.inner.clock().now() + Duration::from_secs(1),
);
pin!(entry);
let _ = entry
.as_mut()
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | ebeb78ed40027032feb77c89a1de4b58d2dcafbf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebeb78ed40027032feb77c89a1de4b58d2dcafbf/tokio/src/runtime/time/tests/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | pin!(entry);
let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
block_on(futures::future::poll_fn(|cx| {
entry.as_mut().poll_elapsed(cx)
}))
.unwrap();
});
th... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | ebeb78ed40027032feb77c89a1de4b58d2dcafbf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebeb78ed40027032feb77c89a1de4b58d2dcafbf/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:5 | .as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
entry.as_mut().reset(start + Duration::from_secs(2));
// shouldn't complete before 2s
block_on(futures::future::poll_fn(|cx| {
entry.as_mut().poll_elapsed(cx)
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | ebeb78ed40027032feb77c89a1de4b58d2dcafbf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebeb78ed40027032feb77c89a1de4b58d2dcafbf/tokio/src/runtime/time/tests/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:6 | fn normal_or_miri<T>(normal: T, miri: T) -> T {
if cfg!(miri) {
miri
} else {
normal
}
}
#[test]
#[cfg(not(loom))]
fn poll_process_levels() {
let rt = rt(true);
let handle = rt.handle();
let mut entries = vec![];
for i in 0..normal_or_miri(1024, 64) {
let mut entry... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | ebeb78ed40027032feb77c89a1de4b58d2dcafbf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebeb78ed40027032feb77c89a1de4b58d2dcafbf/tokio/src/runtime/time/tests/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:7 | }
}
#[test]
#[cfg(not(loom))]
fn poll_process_levels_targeted() {
let mut context = Context::from_waker(noop_waker_ref());
let rt = rt(true);
let handle = rt.handle();
let e1 = TimerEntry::new(
&handle.inner,
handle.inner.clock().now() + Duration::from_millis(193),
);
pin!(e1)... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | ebeb78ed40027032feb77c89a1de4b58d2dcafbf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebeb78ed40027032feb77c89a1de4b58d2dcafbf/tokio/src/runtime/time/tests/mod.rs | 241 | 264 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:1 | #![cfg(not(tokio_wasi))]
use std::{task::Context, time::Duration};
#[cfg(not(loom))]
use futures::task::noop_waker_ref;
use crate::loom::sync::atomic::{AtomicBool, Ordering};
use crate::loom::sync::Arc;
use crate::loom::thread;
use super::TimerEntry;
fn block_on<T>(f: impl std::future::Future<Output = T>) -> T {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/tests/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:2 | }
#[test]
fn single_timer() {
model(|| {
let rt = rt(false);
let handle = rt.handle();
let handle_ = handle.clone();
let jh = thread::spawn(move || {
let entry = TimerEntry::new(
&handle_,
handle_.inner.driver.clock.now() + Duration::from... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/tests/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:3 | let handle_ = handle.clone();
let jh = thread::spawn(move || {
let entry = TimerEntry::new(
&handle_,
handle_.inner.driver.clock.now() + Duration::from_secs(1),
);
pin!(entry);
let _ = entry
.as_mut()
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/tests/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | pin!(entry);
let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
block_on(futures::future::poll_fn(|cx| {
entry.as_mut().poll_elapsed(cx)
}))
.unwrap();
});
th... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:5 | .as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
entry.as_mut().reset(start + Duration::from_secs(2));
// shouldn't complete before 2s
block_on(futures::future::poll_fn(|cx| {
entry.as_mut().poll_elapsed(cx)
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/tests/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:6 | fn normal_or_miri<T>(normal: T, miri: T) -> T {
if cfg!(miri) {
miri
} else {
normal
}
}
#[test]
#[cfg(not(loom))]
fn poll_process_levels() {
let rt = rt(true);
let handle = rt.handle();
let mut entries = vec![];
for i in 0..normal_or_miri(1024, 64) {
let mut entry... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/tests/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:7 | }
}
#[test]
#[cfg(not(loom))]
fn poll_process_levels_targeted() {
let mut context = Context::from_waker(noop_waker_ref());
let rt = rt(true);
let handle = rt.handle();
let e1 = TimerEntry::new(
&handle,
handle.inner.driver.clock.now() + Duration::from_millis(193),
);
pin!(e1);... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/tests/mod.rs | 241 | 264 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:1 | #![cfg(not(tokio_wasi))]
use std::{task::Context, time::Duration};
#[cfg(not(loom))]
use futures::task::noop_waker_ref;
use crate::loom::sync::atomic::{AtomicBool, Ordering};
use crate::loom::sync::Arc;
use crate::loom::thread;
use super::TimerEntry;
fn block_on<T>(f: impl std::future::Future<Output = T>) -> T {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/tests/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:2 | }
#[test]
fn single_timer() {
model(|| {
let rt = rt(false);
let handle = rt.handle();
let handle_ = handle.clone();
let jh = thread::spawn(move || {
let entry =
TimerEntry::new(&handle_, handle_.inner.clock.now() + Duration::from_secs(1));
p... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/tests/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:3 | let jh = thread::spawn(move || {
let entry =
TimerEntry::new(&handle_, handle_.inner.clock.now() + Duration::from_secs(1));
pin!(entry);
let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/tests/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | block_on(futures::future::poll_fn(|cx| {
entry.as_mut().poll_elapsed(cx)
}))
.unwrap();
});
thread::yield_now();
let handle = handle.as_time_handle();
// advance 2s
handle.process_at_time(handle.time_source().now() + 2_000_000_000);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:5 | block_on(futures::future::poll_fn(|cx| {
entry.as_mut().poll_elapsed(cx)
}))
.unwrap();
finished_early_.store(true, Ordering::Relaxed);
});
thread::yield_now();
let handle = handle.as_time_handle();
// This may or may not return a w... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/tests/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:6 | }
#[test]
#[cfg(not(loom))]
fn poll_process_levels() {
let rt = rt(true);
let handle = rt.handle();
let mut entries = vec![];
for i in 0..normal_or_miri(1024, 64) {
let mut entry = Box::pin(TimerEntry::new(
&handle,
handle.inner.clock.now() + Duration::from_millis(i),
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/tests/mod.rs | 201 | 258 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:7 | let mut context = Context::from_waker(noop_waker_ref());
let rt = rt(true);
let handle = rt.handle();
let e1 = TimerEntry::new(
&handle,
handle.inner.clock.now() + Duration::from_millis(193),
);
pin!(e1);
let handle = handle.as_time_handle();
handle.process_at_time(62);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/tests/mod.rs | 241 | 258 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:1 | #![cfg(not(tokio_wasi))]
use std::{task::Context, time::Duration};
#[cfg(not(loom))]
use futures::task::noop_waker_ref;
use crate::loom::sync::atomic::{AtomicBool, Ordering};
use crate::loom::sync::Arc;
use crate::loom::thread;
use crate::runtime::driver::IoUnpark;
use super::{Handle, TimerEntry};
fn block_on<T>(f... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/tests/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:2 | #[cfg(tokio_wasm)]
fn unpark() -> IoUnpark {
use crate::park::thread::ParkThread;
ParkThread::new().unpark()
}
#[test]
fn single_timer() {
model(|| {
let clock = crate::time::Clock::new(true, false);
let time_source = super::TimeSource::new(clock.clone());
let inner = super::Inner:... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/tests/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:3 | model(|| {
let clock = crate::time::Clock::new(true, false);
let time_source = super::TimeSource::new(clock.clone());
let inner = super::Inner::new(time_source.clone(), unpark());
let handle = Handle::new(Arc::new(inner));
let handle_ = handle.clone();
let jh = thread::... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/tests/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | let entry = TimerEntry::new(&handle_, clock.now() + Duration::from_secs(1));
pin!(entry);
let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
block_on(futures::future::poll_fn(|cx| {
entry... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:5 | let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
entry.as_mut().reset(start + Duration::from_secs(2));
// shouldn't complete before 2s
block_on(futures::future::poll_fn(|cx| {
entry.as_... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/tests/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:6 | #[test]
#[cfg(not(loom))]
fn poll_process_levels() {
let clock = crate::time::Clock::new(true, false);
clock.pause();
let time_source = super::TimeSource::new(clock.clone());
let inner = super::Inner::new(time_source, unpark());
let handle = Handle::new(Arc::new(inner));
let mut entries = vec... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/tests/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:7 | #[cfg(not(loom))]
fn poll_process_levels_targeted() {
let mut context = Context::from_waker(noop_waker_ref());
let clock = crate::time::Clock::new(true, false);
clock.pause();
let time_source = super::TimeSource::new(clock.clone());
let inner = super::Inner::new(time_source, unpark());
let ha... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/tests/mod.rs | 241 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:1 | #![cfg(not(tokio_wasi))]
use std::{task::Context, time::Duration};
#[cfg(not(loom))]
use futures::task::noop_waker_ref;
use crate::loom::sync::Arc;
use crate::loom::thread;
use crate::{
loom::sync::atomic::{AtomicBool, Ordering},
park::Unpark,
};
use super::{Handle, TimerEntry};
struct MockUnpark {}
impl U... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/tests/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:2 | #[cfg(loom)]
loom::model(f);
#[cfg(not(loom))]
f();
}
#[test]
fn single_timer() {
model(|| {
let clock = crate::time::Clock::new(true, false);
let time_source = super::TimeSource::new(clock.clone());
let inner = super::Inner::new(time_source.clone(), MockUnpark::mock());
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/tests/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:3 | model(|| {
let clock = crate::time::Clock::new(true, false);
let time_source = super::TimeSource::new(clock.clone());
let inner = super::Inner::new(time_source.clone(), MockUnpark::mock());
let handle = Handle::new(Arc::new(inner));
let handle_ = handle.clone();
let jh ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/tests/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | let entry = TimerEntry::new(&handle_, clock.now() + Duration::from_secs(1));
pin!(entry);
let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
block_on(futures::future::poll_fn(|cx| {
entry... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:5 | let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
entry.as_mut().reset(start + Duration::from_secs(2));
// shouldn't complete before 2s
block_on(futures::future::poll_fn(|cx| {
entry.as_... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/tests/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:6 | #[test]
#[cfg(not(loom))]
fn poll_process_levels() {
let clock = crate::time::Clock::new(true, false);
clock.pause();
let time_source = super::TimeSource::new(clock.clone());
let inner = super::Inner::new(time_source, MockUnpark::mock());
let handle = Handle::new(Arc::new(inner));
let mut ent... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/tests/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:7 | #[cfg(not(loom))]
fn poll_process_levels_targeted() {
let mut context = Context::from_waker(noop_waker_ref());
let clock = crate::time::Clock::new(true, false);
clock.pause();
let time_source = super::TimeSource::new(clock.clone());
let inner = super::Inner::new(time_source, MockUnpark::mock());
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/tests/mod.rs | 241 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:1 | use crate::runtime::time::{EntryList, TimerHandle, TimerShared};
use std::{array, fmt, ptr::NonNull};
/// 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 fiel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/level.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:2 | pub(crate) fn new(level: usize) -> Level {
Level {
level,
occupied: 0,
slot: array::from_fn(|_| EntryList::default()),
}
}
/// Finds the slot that needs to be processed next and returns the slot and
/// `Instant` at which this slot must be processed.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/level.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/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/wheel/level.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/level.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:4 | pub(crate) unsafe fn add_entry(&mut self, item: TimerHandle) {
let slot = slot_for(unsafe { item.registered_when() }, self.level);
self.slot[slot].push_front(item);
self.occupied |= occupied_bit(slot);
}
pub(crate) unsafe fn remove_entry(&mut self, item: NonNull<TimerShared>) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/level.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:5 | 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 >> (level * 6)) % L... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/level.rs | 161 | 192 |
tokio-rs/tokio:tokio/src/runtime/time/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/wheel/level.rs | MIT | ea30a5ea5eee1b3970052f19e8a8b16d0a5c29f4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ea30a5ea5eee1b3970052f19e8a8b16d0a5c29f4/tokio/src/runtime/time/wheel/level.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:4 | pub(crate) unsafe fn add_entry(&mut self, item: TimerHandle) {
let slot = slot_for(item.registered_when(), self.level);
self.slot[slot].push_front(item);
self.occupied |= occupied_bit(slot);
}
pub(crate) unsafe fn remove_entry(&mut self, item: NonNull<TimerShared>) {
let slot ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | ea30a5ea5eee1b3970052f19e8a8b16d0a5c29f4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ea30a5ea5eee1b3970052f19e8a8b16d0a5c29f4/tokio/src/runtime/time/wheel/level.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/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/wheel/level.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/runtime/time/wheel/level.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:4 | pub(crate) unsafe fn add_entry(&mut self, item: TimerHandle) {
let slot = slot_for(item.cached_when(), self.level);
self.slot[slot].push_front(item);
self.occupied |= occupied_bit(slot);
}
pub(crate) unsafe fn remove_entry(&mut self, item: NonNull<TimerShared>) {
let slot = sl... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/runtime/time/wheel/level.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:1 | use crate::runtime::time::{EntryList, TimerHandle, TimerShared};
use std::{array, fmt, ptr::NonNull};
/// 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 fiel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/level.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:2 | Level {
level,
occupied: 0,
slot: array::from_fn(|_| EntryList::default()),
}
}
/// 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) -> O... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/level.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:3 | // 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::MAX_LEVEL_INDEX);
deadline += level_range;
}
debug_assert!(
deadline >= now,
"... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/level.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:4 | pub(crate) unsafe fn add_entry(&mut self, item: TimerHandle) {
let slot = slot_for(item.true_when(), self.level);
self.slot[slot].push_front(item);
self.occupied |= occupied_bit(slot);
}
pub(crate) unsafe fn remove_entry(&mut self, item: NonNull<TimerShared>) {
let slot = slot... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/runtime/time/wheel/level.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:1 | use crate::runtime::time::{EntryList, TimerHandle, TimerShared};
use std::{fmt, ptr::NonNull};
/// 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 tr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/time/wheel/level.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:2 | 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:
// let ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/time/wheel/level.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/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/runtime/time/wheel/level.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/time/wheel/level.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:4 | 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> {
// Use the `o... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/time/wheel/level.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:5 | //
// What this means is that the top level's slots act as a
// 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.
de... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/time/wheel/level.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:6 | Some(slot)
}
pub(crate) unsafe fn add_entry(&mut self, item: TimerHandle) {
let slot = slot_for(item.cached_when(), self.level);
self.slot[slot].push_front(item);
self.occupied |= occupied_bit(slot);
}
pub(crate) unsafe fn remove_entry(&mut self, item: NonNull<TimerShared>) {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/time/wheel/level.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/level.rs:1 | use crate::runtime::time::{EntryList, TimerHandle, TimerShared};
use std::{fmt, ptr::NonNull};
/// 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 tr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/level.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/src/runtime/time/wheel/level.rs | 1 | 60 |
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::entry::STATE_DEREGISTERED;
use super::EntryList;
/// Timing wheel implementation.
///
/// This type provides the has... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:2 | /// 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 = (1 << (6 * NUM_LEVELS)) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:3 | /// `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` is pinned and will not be dropped without first
/// being deregistered.
pub(crate) unsafe fn i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:4 | } else {
debug_assert!(
self.elapsed <= when,
"elapsed={}; when={}",
self.elapsed,
when
);
let level = self.level_for(when);
self.levels[level].remove_entry(item);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/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(Expiration {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:6 | 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/wheel/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:7 | }
Err(expiration_tick) => {
let level = level_for(expiration.deadline, expiration_tick);
unsafe {
self.levels[level].add_entry(item);
}
}
}
}
}
fn set_elapsed(&mut self, when:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:8 | 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(loom)))]
mod test {
use super::*;
#[test]
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/mod.rs | 281 | 332 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:9 | if pos < 64 {
let a = a + 1;
assert_eq!(
level,
level_for(0, a as u64),
"level_for({a}) -- binary = {a:b}"
);
}
}
}
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/wheel/mod.rs | 321 | 332 |
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::entry::STATE_DEREGISTERED;
use super::EntryList;
/// Timing wheel implementation.
///
/// This type provides the has... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 8f81e0814bd121683ebdfa21b494d1b77fb36403 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time/wheel/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:2 | /// 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 = (1 << (6 * NUM_LEVELS)) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 8f81e0814bd121683ebdfa21b494d1b77fb36403 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/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 | 8f81e0814bd121683ebdfa21b494d1b77fb36403 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/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().registered_when();
if when == STATE_DEREGISTERED {
self.pending.remove(item);
} else {
debug_assert!(
self.elapsed <= when,
"elapsed={}; when={}",
self.elapsed,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 8f81e0814bd121683ebdfa21b494d1b77fb36403 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time/wheel/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:5 | 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 !self.pending.is_empty() {
// Expire immediately... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 8f81e0814bd121683ebdfa21b494d1b77fb36403 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/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 level in &self.levels[start_level..] {
if let Some(e2) = level.next_expiration(self.elapsed) {
if e2.deadline < before {
r... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 8f81e0814bd121683ebdfa21b494d1b77fb36403 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time/wheel/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:7 | Ok(()) => {
// Item was expired
self.pending.push_front(item);
}
Err(expiration_tick) => {
let level = level_for(expiration.deadline, expiration_tick);
unsafe {
self.levels[level].add_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 8f81e0814bd121683ebdfa21b494d1b77fb36403 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time/wheel/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:8 | // 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;
}
let leading_zeros = masked.leading... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 8f81e0814bd121683ebdfa21b494d1b77fb36403 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time/wheel/mod.rs | 281 | 335 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:9 | );
}
if pos < 64 {
let a = a + 1;
assert_eq!(
level,
level_for(0, a as u64),
"level_for({a}) -- binary = {a:b}"
);
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 8f81e0814bd121683ebdfa21b494d1b77fb36403 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8f81e0814bd121683ebdfa21b494d1b77fb36403/tokio/src/runtime/time/wheel/mod.rs | 321 | 335 |
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::{array, ptr::NonNull};
use super::entry::STATE_DEREGISTERED;
use super::EntryList;
/// Timing wheel implementation.
///
/// This type provide... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time/wheel/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:2 | /// 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 = (1 << (6 * NUM_LEVELS)) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time/wheel/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:3 | ///
/// # Safety
///
/// This function registers item into an intrusive linked list. The caller
/// must ensure that `item` is pinned and will not be dropped without first
/// being deregistered.
pub(crate) unsafe fn insert(
&mut self,
item: TimerHandle,
) -> Result<u64, (Tim... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time/wheel/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:4 | debug_assert!(
self.elapsed <= when,
"elapsed={}; when={}",
self.elapsed,
when
);
let level = self.level_for(when);
self.levels[level].remove_entry(item);
}
}
}
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/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(Expiration {
lev... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time/wheel/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:6 | 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/wheel/mod.rs | MIT | ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time/wheel/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:7 | Err(expiration_tick) => {
let level = level_for(expiration.deadline, expiration_tick);
unsafe {
self.levels[level].add_entry(item);
}
}
}
}
}
fn set_elapsed(&mut self, when: u64) {
as... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time/wheel/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:9 | let a = a + 1;
assert_eq!(
level,
level_for(0, a as u64),
"level_for({a}) -- binary = {a:b}"
);
}
}
}
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab3996a6dd2aabce13b01f2b4de7de778a7d0c5d/tokio/src/runtime/time/wheel/mod.rs | 321 | 331 |
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::{array, ptr::NonNull};
use super::entry::STATE_DEREGISTERED;
use super::EntryList;
/// Timing wheel implementation.
///
/// This type provide... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/time/wheel/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:2 | /// Entries queued for firing
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(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/time/wheel/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:3 | /// 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` is pinned and will not be dropped without first
/// being deregistere... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/time/wheel/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:4 | if when == STATE_DEREGISTERED {
self.pending.remove(item);
} else {
debug_assert!(
self.elapsed <= when,
"elapsed={}; when={}",
self.elapsed,
when
);
let level = s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/time/wheel/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:5 | break;
}
}
}
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
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/time/wheel/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:6 | fn no_expirations_before(&self, start_level: usize, before: u64) -> bool {
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;
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/time/wheel/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:7 | // Item was expired
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 | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/time/wheel/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:8 | // 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;
}
let leading_zeros = masked.leading_zeros() as usize;
let significant = 63 - leading_zeros;
significant / NU... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/time/wheel/mod.rs | 281 | 334 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:9 | }
if pos < 64 {
let a = a + 1;
assert_eq!(
level,
level_for(0, a as u64),
"level_for({a}) -- binary = {a:b}"
);
}
}
}
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/time/wheel/mod.rs | 321 | 334 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:2 | /// Entries queued for firing
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(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | ea30a5ea5eee1b3970052f19e8a8b16d0a5c29f4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ea30a5ea5eee1b3970052f19e8a8b16d0a5c29f4/tokio/src/runtime/time/wheel/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:3 | /// 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` is pinned and will not be dropped without first
/// being deregistere... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | ea30a5ea5eee1b3970052f19e8a8b16d0a5c29f4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ea30a5ea5eee1b3970052f19e8a8b16d0a5c29f4/tokio/src/runtime/time/wheel/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:3 | /// 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` is pinned and will not be dropped without first
/// being deregistere... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 4cbcb687f429f2a4cee948b0462e23f86ef95822 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cbcb687f429f2a4cee948b0462e23f86ef95822/tokio/src/runtime/time/wheel/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:6 | fn no_expirations_before(&self, start_level: usize, before: u64) -> bool {
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;
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/wheel/mod.rs | MIT | 4cbcb687f429f2a4cee948b0462e23f86ef95822 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cbcb687f429f2a4cee948b0462e23f86ef95822/tokio/src/runtime/time/wheel/mod.rs | 201 | 260 |
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::{array, ptr::NonNull};
use super::EntryList;
/// Timing wheel implementation.
///
/// This type provides the hashed timing wheel implementati... | 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 | 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 | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/time/wheel/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/wheel/mod.rs:3 | ///
/// `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` is pinned and will not be dropped without first
/// being deregistered.
pub(crate) uns... | 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 | 81 | 140 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.