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/mod.rs:8 | waker_idx += 1;
if waker_idx == waker_list.len() {
// Wake a batch of wakers. To avoid deadlock, we must do this with the lock temporarily dropped.
drop(lock);
for waker in waker_list.iter_mut() {
waker.take().unwrap()... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 3f379abda4f980086ab44f4912eff877bdb75120 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f379abda4f980086ab44f4912eff877bdb75120/tokio/src/runtime/time/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:9 | /// `add_entry` must not be called concurrently.
pub(self) unsafe fn clear_entry(&self, entry: NonNull<TimerShared>) {
unsafe {
let mut lock = self.get().lock();
if entry.as_ref().might_be_registered() {
lock.wheel.remove(entry);
}
entry.as_r... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 3f379abda4f980086ab44f4912eff877bdb75120 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f379abda4f980086ab44f4912eff877bdb75120/tokio/src/runtime/time/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:10 | entry.set_expiration(new_tick);
// Note: We don't have to worry about racing with some other resetting
// thread, because add_entry and reregister require exclusive control of
// the timer entry.
match unsafe { lock.wheel.insert(entry) } {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 3f379abda4f980086ab44f4912eff877bdb75120 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f379abda4f980086ab44f4912eff877bdb75120/tokio/src/runtime/time/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:11 | }
impl TimerUnpark {
fn new(driver: &Driver) -> TimerUnpark {
TimerUnpark {
inner: driver.park.unpark(),
#[cfg(feature = "test-util")]
did_wake: driver.did_wake.clone(),
}
}
pub(crate) fn unpark(&self) {
#[cfg(feature = "test-util")]
sel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 3f379abda4f980086ab44f4912eff877bdb75120 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f379abda4f980086ab44f4912eff877bdb75120/tokio/src/runtime/time/mod.rs | 401 | 454 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:12 | // Check whether the driver has been shutdown
pub(super) fn is_shutdown(&self) -> bool {
self.is_shutdown.load(Ordering::SeqCst)
}
}
impl fmt::Debug for Inner {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Inner").finish()
}
}
#[cfg(test)]
mod tests; | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 3f379abda4f980086ab44f4912eff877bdb75120 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f379abda4f980086ab44f4912eff877bdb75120/tokio/src/runtime/time/mod.rs | 441 | 454 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:3 | /// [paper]: http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf
/// [sleep]: crate::time::Sleep
/// [timeout]: crate::time::Timeout
/// [interval]: crate::time::Interval
#[derive(Debug)]
pub(crate) struct Driver {
/// Timing backend in use.
time_source: TimeSource,
/// Parker to delegat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:4 | elapsed: u64,
/// The earliest time at which we promise to wake up without unparking.
next_wake: Option<NonZeroU64>,
/// Timer wheel.
wheel: wheel::Wheel,
}
// ===== impl Driver =====
impl Driver {
/// Creates a new `Driver` instance that uses `park` to block the current
/// thread and `time... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:5 | pub(crate) fn park_timeout(&mut self, handle: &Handle, duration: Duration) {
self.park_internal(handle, Some(duration))
}
pub(crate) fn shutdown(&mut self, handle: &Handle) {
if handle.is_shutdown() {
return;
}
handle.get().is_shutdown.store(true, Ordering::SeqCst);... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:6 | }
self.park_thread_timeout(duration);
} else {
self.park.park_timeout(Duration::from_secs(0));
}
}
None => {
if let Some(duration) = limit {
self.park_thread_timeout(duration);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:7 | fn did_wake(&self) -> bool {
self.did_wake.swap(false, Ordering::SeqCst)
}
}
cfg_not_test_util! {
fn park_thread_timeout(&mut self, duration: Duration) {
self.park.park_timeout(duration);
}
}
}
impl Handle {
/// Runs timer related logic, and returns the ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:8 | if let Some(waker) = unsafe { entry.fire(Ok(())) } {
waker_list[waker_idx] = Some(waker);
waker_idx += 1;
if waker_idx == waker_list.len() {
// Wake a batch of wakers. To avoid deadlock, we must do this with the lock temporarily dropped.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:9 | /// not appear to be registered.
///
/// SAFETY: The timer must not be registered with some other driver, and
/// `add_entry` must not be called concurrently.
pub(self) unsafe fn clear_entry(&self, entry: NonNull<TimerShared>) {
unsafe {
let mut lock = self.get().lock();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:10 | // Note: We don't have to worry about racing with some other resetting
// thread, because add_entry and reregister require exclusive control of
// the timer entry.
match unsafe { lock.wheel.insert(entry) } {
Ok(when) => {
if loc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:11 | impl TimerUnpark {
fn new(driver: &Driver) -> TimerUnpark {
TimerUnpark {
inner: driver.park.unpark(),
#[cfg(feature = "test-util")]
did_wake: driver.did_wake.clone(),
}
}
pub(crate) fn unpark(&self) {
#[cfg(feature = "test-util")]
self.d... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/mod.rs | 401 | 453 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:12 | pub(super) fn is_shutdown(&self) -> bool {
self.is_shutdown.load(Ordering::SeqCst)
}
}
impl fmt::Debug for Inner {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Inner").finish()
}
}
#[cfg(test)]
mod tests; | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/mod.rs | 441 | 453 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:1 | // Currently, rust warns when an unsafe fn contains an unsafe {} block. However,
// in the future, this will change to the reverse. For now, suppress this
// warning and generally stick with being explicit about unsafety.
#![allow(unused_unsafe)]
#![cfg_attr(not(feature = "rt"), allow(dead_code))]
//! Time driver.
mo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 71b29b9409b52548c56102f993f9ff670060a22b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71b29b9409b52548c56102f993f9ff670060a22b/tokio/src/runtime/time/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:3 | /// * Level 2: 64 x ~4 second slots.
/// * Level 3: 64 x ~4 minute slots.
/// * Level 4: 64 x ~4 hour slots.
/// * Level 5: 64 x ~12 day slots.
///
/// When the timer processes entries at level zero, it will notify all the
/// `Sleep` instances as their deadlines have been reached. For all higher
/// levels, all entrie... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 71b29b9409b52548c56102f993f9ff670060a22b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71b29b9409b52548c56102f993f9ff670060a22b/tokio/src/runtime/time/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:4 | pub(super) is_shutdown: AtomicBool,
/// Unparker that can be used to wake the time driver.
unpark: IoUnpark,
}
/// Time state shared which must be protected by a `Mutex`
struct InnerState {
/// Timing backend in use.
time_source: TimeSource,
/// The last published timer `elapsed` value.
elaps... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 71b29b9409b52548c56102f993f9ff670060a22b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71b29b9409b52548c56102f993f9ff670060a22b/tokio/src/runtime/time/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:5 | (driver, handle)
}
pub(crate) fn unpark(&self) -> TimerUnpark {
TimerUnpark::new(self)
}
pub(crate) fn park(&mut self, handle: &Handle) {
self.park_internal(handle, None)
}
pub(crate) fn park_timeout(&mut self, handle: &Handle, duration: Duration) {
self.park_internal(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 71b29b9409b52548c56102f993f9ff670060a22b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71b29b9409b52548c56102f993f9ff670060a22b/tokio/src/runtime/time/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:6 | match next_wake {
Some(when) => {
let now = self.time_source.now();
// Note that we effectively round up to 1ms here - this avoids
// very short-duration microsecond-resolution sleeps that the OS
// might treat as zero-length.
l... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 71b29b9409b52548c56102f993f9ff670060a22b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71b29b9409b52548c56102f993f9ff670060a22b/tokio/src/runtime/time/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:7 | // before the "duration" elapsed (usually caused by a
// yield in `Runtime::block_on`). In this case, we don't
// advance the clock.
if !self.did_wake() {
// Simulate advancing time
clock.advance(duration);
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 71b29b9409b52548c56102f993f9ff670060a22b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71b29b9409b52548c56102f993f9ff670060a22b/tokio/src/runtime/time/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:8 | // guarantees that an Instant is monotonic, but can happen when running
// Linux in a VM on a Windows host due to std incorrectly trusting the
// hardware clock to be monotonic.
//
// See <https://github.com/tokio-rs/tokio/issues/3619> for more information.
no... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 71b29b9409b52548c56102f993f9ff670060a22b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71b29b9409b52548c56102f993f9ff670060a22b/tokio/src/runtime/time/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:9 | for waker in waker_list[0..waker_idx].iter_mut() {
waker.take().unwrap().wake();
}
}
/// Removes a registered timer from the driver.
///
/// The timer will be moved to the cancelled state. Wakers will _not_ be
/// invoked. If the timer is already completed, this function is a no... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 71b29b9409b52548c56102f993f9ff670060a22b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71b29b9409b52548c56102f993f9ff670060a22b/tokio/src/runtime/time/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:10 | if unsafe { entry.as_ref().might_be_registered() } {
lock.wheel.remove(entry);
}
// Now that we have exclusive control of this entry, mint a handle to reinsert it.
let entry = entry.as_ref().handle();
if self.is_shutdown() {
unsafe { entr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 71b29b9409b52548c56102f993f9ff670060a22b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71b29b9409b52548c56102f993f9ff670060a22b/tokio/src/runtime/time/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:11 | waker.wake();
}
}
}
pub(crate) struct TimerUnpark {
inner: IoUnpark,
#[cfg(feature = "test-util")]
did_wake: Arc<AtomicBool>,
}
impl TimerUnpark {
fn new(driver: &Driver) -> TimerUnpark {
TimerUnpark {
inner: driver.park.unpark(),
#[cfg(feature = "test-uti... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 71b29b9409b52548c56102f993f9ff670060a22b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71b29b9409b52548c56102f993f9ff670060a22b/tokio/src/runtime/time/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:12 | }),
unpark,
is_shutdown: AtomicBool::new(false),
}
}
/// Locks the driver's inner structure
pub(super) fn lock(&self) -> crate::loom::sync::MutexGuard<'_, InnerState> {
self.state.lock()
}
// Check whether the driver has been shutdown
pub(super) fn is_sh... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 71b29b9409b52548c56102f993f9ff670060a22b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71b29b9409b52548c56102f993f9ff670060a22b/tokio/src/runtime/time/mod.rs | 441 | 465 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:3 | /// * Level 2: 64 x ~4 second slots.
/// * Level 3: 64 x ~4 minute slots.
/// * Level 4: 64 x ~4 hour slots.
/// * Level 5: 64 x ~12 day slots.
///
/// When the timer processes entries at level zero, it will notify all the
/// `Sleep` instances as their deadlines have been reached. For all higher
/// levels, all entrie... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:4 | pub(super) state: Mutex<InnerState>,
/// True if the driver is being shutdown.
pub(super) is_shutdown: AtomicBool,
/// Unparker that can be used to wake the time driver.
unpark: IoUnpark,
}
/// Time state shared which must be protected by a `Mutex`
struct InnerState {
/// Timing backend in use.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:5 | #[cfg(feature = "test-util")]
did_wake: Arc::new(AtomicBool::new(false)),
}
}
/// Returns a handle to the timer.
///
/// The `Handle` is how `Sleep` instances are created. The `Sleep` instances
/// can either be created directly or the `Handle` instance can be passed to
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:6 | fn park_internal(&mut self, limit: Option<Duration>) {
let mut lock = self.handle.get().state.lock();
assert!(!self.handle.is_shutdown());
let next_wake = lock.wheel.next_expiration_time();
lock.next_wake =
next_wake.map(|t| NonZeroU64::new(t).unwrap_or_else(|| NonZeroU64::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:7 | self.handle.process();
}
cfg_test_util! {
fn park_thread_timeout(&mut self, duration: Duration) {
let clock = &self.time_source.clock;
if clock.is_paused() {
self.park.park_timeout(Duration::from_secs(0));
// If the time driver was woken, then t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:8 | self.process_at_time(now)
}
pub(self) fn process_at_time(&self, mut now: u64) {
let mut waker_list: [Option<Waker>; 32] = Default::default();
let mut waker_idx = 0;
let mut lock = self.get().lock();
if now < lock.elapsed {
// Time went backwards! This normally shou... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:9 | }
}
// Update the elapsed cache
lock.elapsed = lock.wheel.elapsed();
lock.next_wake = lock
.wheel
.poll_at()
.map(|t| NonZeroU64::new(t).unwrap_or_else(|| NonZeroU64::new(1).unwrap()));
drop(lock);
for waker in waker_list[0..waker_id... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:10 | ///
/// SAFETY: The timer must be either unregistered, or registered with this
/// driver. No other threads are allowed to concurrently manipulate the
/// timer at all (the current thread should hold an exclusive reference to
/// the `TimerEntry`)
pub(self) unsafe fn reregister(&self, new_tick: u64,... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:11 | },
}
}
// Must release lock before invoking waker to avoid the risk of deadlock.
};
// The timer was fired synchronously as a result of the reregistration.
// Wake the waker; this is needed because we might reset _after_ a poll,
// and otherwise ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:12 | #[cfg(feature = "test-util")]
self.did_wake.store(true, Ordering::SeqCst);
self.inner.unpark();
}
}
// ===== impl Inner =====
impl Inner {
pub(self) fn new(time_source: TimeSource, unpark: IoUnpark) -> Self {
Inner {
state: Mutex::new(InnerState {
time_sour... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 99aa8d12b7ad2ef011a7a9f652f7455b3f175821 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/time/mod.rs | 441 | 482 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:1 | // Currently, rust warns when an unsafe fn contains an unsafe {} block. However,
// in the future, this will change to the reverse. For now, suppress this
// warning and generally stick with being explicit about unsafety.
#![allow(unused_unsafe)]
#![cfg_attr(not(feature = "rt"), allow(dead_code))]
//! Time driver.
mo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:3 | /// [paper]: http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf
/// [sleep]: crate::time::Sleep
/// [timeout]: crate::time::Timeout
/// [interval]: crate::time::Interval
#[derive(Debug)]
pub(crate) struct Driver<P: Park + 'static> {
/// Timing backend in use.
time_source: TimeSource,
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:4 | time_source: TimeSource,
/// The last published timer `elapsed` value.
elapsed: u64,
/// The earliest time at which we promise to wake up without unparking.
next_wake: Option<NonZeroU64>,
/// Timer wheel.
wheel: wheel::Wheel,
}
// ===== impl Driver =====
impl<P> Driver<P>
where
P: Park ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:5 | /// `with_default`, setting the timer as the default timer for the execution
/// context.
pub(crate) fn handle(&self) -> Handle {
self.handle.clone()
}
fn park_internal(&mut self, limit: Option<Duration>) -> Result<(), P::Error> {
let mut lock = self.handle.get().state.lock();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:6 | }
}
}
// Process pending timers after waking up
self.handle.process();
Ok(())
}
cfg_test_util! {
fn park_timeout(&mut self, duration: Duration) -> Result<(), P::Error> {
let clock = &self.time_source.clock;
if clock.is_paused() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:7 | }
}
}
impl Handle {
/// Runs timer related logic, and returns the next wakeup time
pub(self) fn process(&self) {
let now = self.time_source().now();
self.process_at_time(now)
}
pub(self) fn process_at_time(&self, mut now: u64) {
let mut waker_list: [Option<Waker>; 32] = De... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:8 | for waker in waker_list.iter_mut() {
waker.take().unwrap().wake();
}
waker_idx = 0;
lock = self.get().lock();
}
}
}
// Update the elapsed cache
lock.elapsed = lock.wheel.elapsed();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:9 | if entry.as_ref().might_be_registered() {
lock.wheel.remove(entry);
}
entry.as_ref().handle().fire(Ok(()));
}
}
/// Removes and re-adds an entry to the driver.
///
/// SAFETY: The timer must be either unregistered, or registered with this
/// driver.... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:10 | .unwrap_or(true)
{
self.inner.unpark.unpark();
}
None
}
Err((entry, crate::time::error::InsertError::Elapsed)) => unsafe {
entry.fire(Ok(()))
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:11 | fn park_timeout(&mut self, duration: Duration) -> Result<(), Self::Error> {
self.park_internal(Some(duration))
}
fn shutdown(&mut self) {
if self.handle.is_shutdown() {
return;
}
self.handle.get().is_shutdown.store(true, Ordering::SeqCst);
// Advance time f... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:12 | #[cfg(feature = "test-util")]
did_wake: driver.did_wake.clone(),
}
}
}
impl<P: Park + 'static> Unpark for TimerUnpark<P> {
fn unpark(&self) {
#[cfg(feature = "test-util")]
self.did_wake.store(true, Ordering::SeqCst);
self.inner.unpark();
}
}
// ===== impl Inner... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/mod.rs | 441 | 490 |
tokio-rs/tokio:tokio/src/runtime/time/source.rs:1 | use super::MAX_SAFE_MILLIS_DURATION;
use crate::time::{Clock, Duration, Instant};
/// A structure which handles conversion from Instants to `u64` timestamps.
#[derive(Debug)]
pub(crate) struct TimeSource {
start_time: Instant,
}
impl TimeSource {
pub(crate) fn new(clock: &Clock) -> Self {
Self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/source.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/source.rs | 1 | 45 |
tokio-rs/tokio:tokio/src/runtime/time/source.rs:1 | use super::MAX_SAFE_MILLIS_DURATION;
use crate::time::{Clock, Duration, Instant};
/// A structure which handles conversion from Instants to `u64` timestamps.
#[derive(Debug)]
pub(crate) struct TimeSource {
start_time: Instant,
}
impl TimeSource {
pub(crate) fn new(clock: &Clock) -> Self {
Self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/source.rs | MIT | 28439e2269f2696a5009f2f05ce8f39b7fa13217 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/28439e2269f2696a5009f2f05ce8f39b7fa13217/tokio/src/runtime/time/source.rs | 1 | 37 |
tokio-rs/tokio:tokio/src/runtime/time/source.rs:1 | use super::MAX_SAFE_MILLIS_DURATION;
use crate::time::{Clock, Duration, Instant};
/// A structure which handles conversion from Instants to `u64` timestamps.
#[derive(Debug)]
pub(crate) struct TimeSource {
start_time: Instant,
}
impl TimeSource {
pub(crate) fn new(clock: &Clock) -> Self {
Self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/source.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/time/source.rs | 1 | 39 |
tokio-rs/tokio:tokio/src/runtime/time/source.rs:1 | use super::MAX_SAFE_MILLIS_DURATION;
use crate::time::{Clock, Duration, Instant};
/// A structure which handles conversion from Instants to u64 timestamps.
#[derive(Debug)]
pub(crate) struct TimeSource {
start_time: Instant,
}
impl TimeSource {
pub(crate) fn new(clock: &Clock) -> Self {
Self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/source.rs | MIT | 2a54ad01d0945c851a093849c83019de69e98dee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2a54ad01d0945c851a093849c83019de69e98dee/tokio/src/runtime/time/source.rs | 1 | 39 |
tokio-rs/tokio:tokio/src/runtime/time/source.rs:1 | use crate::time::{Clock, Duration, Instant};
/// A structure which handles conversion from Instants to u64 timestamps.
#[derive(Debug)]
pub(crate) struct TimeSource {
start_time: Instant,
}
impl TimeSource {
pub(crate) fn new(clock: &Clock) -> Self {
Self {
start_time: clock.now(),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/source.rs | MIT | 0c8e8248f8de281f22ad6f30b967053f44fff66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0c8e8248f8de281f22ad6f30b967053f44fff66e/tokio/src/runtime/time/source.rs | 1 | 38 |
tokio-rs/tokio:tokio/src/runtime/time/source.rs:1 | use crate::time::{Clock, Duration, Instant};
use std::convert::TryInto;
/// A structure which handles conversion from Instants to u64 timestamps.
#[derive(Debug)]
pub(crate) struct TimeSource {
start_time: Instant,
}
impl TimeSource {
pub(crate) fn new(clock: &Clock) -> Self {
Self {
star... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/source.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/source.rs | 1 | 40 |
tokio-rs/tokio:tokio/src/runtime/time/source.rs:1 | use crate::time::{Clock, Duration, Instant};
use std::convert::TryInto;
/// A structure which handles conversion from Instants to u64 timestamps.
#[derive(Debug)]
pub(crate) struct TimeSource {
pub(crate) clock: Clock,
start_time: Instant,
}
impl TimeSource {
pub(crate) fn new(clock: Clock) -> Self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/source.rs | MIT | 80568dfc6da83f9c68c63bd9de66bcda295c76a9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/80568dfc6da83f9c68c63bd9de66bcda295c76a9/tokio/src/runtime/time/source.rs | 1 | 42 |
tokio-rs/tokio:tokio/src/runtime/time/source.rs:1 | use crate::time::{Clock, Duration, Instant};
use std::convert::TryInto;
/// A structure which handles conversion from Instants to u64 timestamps.
#[derive(Debug, Clone)]
pub(crate) struct TimeSource {
pub(crate) clock: Clock,
start_time: Instant,
}
impl TimeSource {
pub(crate) fn new(clock: Clock) -> Sel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/source.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/source.rs | 1 | 42 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:1 | #![cfg(not(target_os = "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>) ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/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.clone(),
handle_.inner.driver().clock().now()... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/tests/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:3 | handle_.inner.clone(),
handle_.inner.driver().clock().now() + Duration::from_secs(1),
);
pin!(entry);
let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
let _ = entry
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/tests/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | .as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
block_on(std::future::poll_fn(|cx| entry.as_mut().poll_elapsed(cx))).unwrap();
});
thread::yield_now();
let time = handle.inner.driver().time();
let clock = handle.inner.dri... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:5 | // shouldn't complete before 2s
block_on(std::future::poll_fn(|cx| entry.as_mut().poll_elapsed(cx))).unwrap();
finished_early_.store(true, Ordering::Relaxed);
});
thread::yield_now();
let handle = handle.inner.driver().time();
handle.process_at_time(
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/tests/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:6 | #[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.inner.clone(),
handle.inner.driver().clock().now() + Duration::fro... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/tests/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:7 | let handle = rt.handle();
let e1 = TimerEntry::new(
handle.inner.clone(),
handle.inner.driver().clock().now() + Duration::from_millis(193),
);
pin!(e1);
let handle = handle.inner.driver().time();
handle.process_at_time(62);
assert!(e1.as_mut().poll_elapsed(&mut context).is_pen... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/tests/mod.rs | 241 | 269 |
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.clone(),
handle_.inner.driver().clock().now()... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/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_.inner.clone(),
handle_.inner.driver().clock().now() + Duration::from_secs(1),
);
pin!(entry);
let _ = entry
.as_mut()
.poll_elapsed(&mut ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/time/tests/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
block_on(std::future::poll_fn(|cx| entry.as_mut().poll_elapsed(cx))).unwrap();
});
thread::yield_now();
let time = handle.inner.driver().time();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:5 | entry.as_mut().reset(start + Duration::from_secs(2), true);
// shouldn't complete before 2s
block_on(std::future::poll_fn(|cx| entry.as_mut().poll_elapsed(cx))).unwrap();
finished_early_.store(true, Ordering::Relaxed);
});
thread::yield_now();
let handle =... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/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.inner.clone(),
handle.inner.driver().clock().now() + Du... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/time/tests/mod.rs | 201 | 260 |
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.inner.clone(),
handle.inner.driver().clock().now() + Duration::from_millis(193),
);
pin!(e1);
let handle = handle.inner.driver().time();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/time/tests/mod.rs | 241 | 272 |
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.clone(),
handle_.inner.driver().clock().now()... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/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_.inner.clone(),
handle_.inner.driver().clock().now() + Duration::from_secs(1),
);
pin!(entry);
let _ = entry
.as_mut()
.poll_elapsed(&mut ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/runtime/time/tests/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
block_on(std::future::poll_fn(|cx| entry.as_mut().poll_elapsed(cx))).unwrap();
});
thread::yield_now();
let time = handle.inner.driver().time();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:5 | entry.as_mut().reset(start + Duration::from_secs(2), true);
// shouldn't complete before 2s
block_on(std::future::poll_fn(|cx| entry.as_mut().poll_elapsed(cx))).unwrap();
finished_early_.store(true, Ordering::Relaxed);
});
thread::yield_now();
let handle =... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/runtime/time/tests/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:6 | 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 = Box::pin(TimerEntry::new(
handle.inner.clone(),
handle.inner.driver().clock... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/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 rt = rt(true);
let handle = rt.handle();
let e1 = TimerEntry::new(
handle.inner.clone(),
handle.inner.driver().clock().now() + Duration::from_millis(193),
);
pin!(... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/runtime/time/tests/mod.rs | 241 | 274 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:1 | #![cfg(not(target_os = "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>) ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 75c953bd639ee8630f678a02edd87e7814b04abc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/75c953bd639ee8630f678a02edd87e7814b04abc/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.clone(),
handle_.inner.driver().clock().now()... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 75c953bd639ee8630f678a02edd87e7814b04abc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/75c953bd639ee8630f678a02edd87e7814b04abc/tokio/src/runtime/time/tests/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:3 | let handle = rt.handle();
let handle_ = handle.clone();
let jh = thread::spawn(move || {
let entry = TimerEntry::new(
handle_.inner.clone(),
handle_.inner.driver().clock().now() + Duration::from_secs(1),
);
pin!(entry);
le... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 75c953bd639ee8630f678a02edd87e7814b04abc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/75c953bd639ee8630f678a02edd87e7814b04abc/tokio/src/runtime/time/tests/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | handle_.inner.driver().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| {
entr... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 75c953bd639ee8630f678a02edd87e7814b04abc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/75c953bd639ee8630f678a02edd87e7814b04abc/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:5 | pin!(entry);
let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
entry.as_mut().reset(start + Duration::from_secs(2), true);
// shouldn't complete before 2s
block_on(futures::future::poll_fn(... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 75c953bd639ee8630f678a02edd87e7814b04abc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/75c953bd639ee8630f678a02edd87e7814b04abc/tokio/src/runtime/time/tests/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:6 | assert!(finished_early.load(Ordering::Relaxed));
})
}
#[cfg(not(loom))]
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 entrie... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 75c953bd639ee8630f678a02edd87e7814b04abc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/75c953bd639ee8630f678a02edd87e7814b04abc/tokio/src/runtime/time/tests/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:7 | assert!(future.as_mut().poll_elapsed(&mut context).is_ready());
} else {
assert!(future.as_mut().poll_elapsed(&mut context).is_pending());
}
}
}
}
#[test]
#[cfg(not(loom))]
fn poll_process_levels_targeted() {
let mut context = Context::from_waker(noop_waker_ref()... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 75c953bd639ee8630f678a02edd87e7814b04abc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/75c953bd639ee8630f678a02edd87e7814b04abc/tokio/src/runtime/time/tests/mod.rs | 241 | 283 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:7 | assert!(future.as_mut().poll_elapsed(&mut context).is_ready());
} else {
assert!(future.as_mut().poll_elapsed(&mut context).is_pending());
}
}
}
}
#[test]
#[cfg(not(loom))]
fn poll_process_levels_targeted() {
let mut context = Context::from_waker(noop_waker_ref()... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | 1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210/tokio/src/runtime/time/tests/mod.rs | 241 | 269 |
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.clone(),
handle_.inner.driver().clock().now()... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | f6eb1ee19687bfd6cc7bf5c675d946970854013e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f6eb1ee19687bfd6cc7bf5c675d946970854013e/tokio/src/runtime/time/tests/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:3 | let handle = rt.handle();
let handle_ = handle.clone();
let jh = thread::spawn(move || {
let entry = TimerEntry::new(
handle_.inner.clone(),
handle_.inner.driver().clock().now() + Duration::from_secs(1),
);
pin!(entry);
le... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | f6eb1ee19687bfd6cc7bf5c675d946970854013e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f6eb1ee19687bfd6cc7bf5c675d946970854013e/tokio/src/runtime/time/tests/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | handle_.inner.driver().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| {
entr... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | f6eb1ee19687bfd6cc7bf5c675d946970854013e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f6eb1ee19687bfd6cc7bf5c675d946970854013e/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:5 | pin!(entry);
let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));
entry.as_mut().reset(start + Duration::from_secs(2), true);
// shouldn't complete before 2s
block_on(futures::future::poll_fn(... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | f6eb1ee19687bfd6cc7bf5c675d946970854013e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f6eb1ee19687bfd6cc7bf5c675d946970854013e/tokio/src/runtime/time/tests/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:6 | }
#[cfg(not(loom))]
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) {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | f6eb1ee19687bfd6cc7bf5c675d946970854013e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f6eb1ee19687bfd6cc7bf5c675d946970854013e/tokio/src/runtime/time/tests/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:7 | assert!(future.as_mut().poll_elapsed(&mut context).is_pending());
}
}
}
}
#[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(
handl... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | f6eb1ee19687bfd6cc7bf5c675d946970854013e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f6eb1ee19687bfd6cc7bf5c675d946970854013e/tokio/src/runtime/time/tests/mod.rs | 241 | 267 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:1 | #![cfg(not(target_os = "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>) ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/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.driver().clock().now() + Dura... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/time/tests/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:3 | let handle = rt.handle();
let handle_ = handle.clone();
let jh = thread::spawn(move || {
let entry = TimerEntry::new(
&handle_.inner,
handle_.inner.driver().clock().now() + Duration::from_secs(1),
);
pin!(entry);
let _ = e... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/time/tests/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | handle_.inner.driver().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| {
entr... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:6 | }
#[cfg(not(loom))]
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) {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/time/tests/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:7 | assert!(future.as_mut().poll_elapsed(&mut context).is_pending());
}
}
}
}
#[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(
&hand... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/time/tests/mod.rs | 241 | 267 |
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 | 68b02db1543880cb95ceccc39f453f8dd2223f04 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/68b02db1543880cb95ceccc39f453f8dd2223f04/tokio/src/runtime/time/tests/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:4 | handle_.inner.driver().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| {
entr... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/tests/mod.rs:5 | pin!(entry);
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| {... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/time/tests/mod.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/tests/mod.rs | 161 | 220 |
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.driver().clock().now() + Dura... | 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 | 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.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 | 7483509746e1d82d7fc3642fd8431116c96aa387 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7483509746e1d82d7fc3642fd8431116c96aa387/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 | 7483509746e1d82d7fc3642fd8431116c96aa387 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7483509746e1d82d7fc3642fd8431116c96aa387/tokio/src/runtime/time/tests/mod.rs | 121 | 180 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.