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/entry.rs:18 | // - https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/internal/cpu/cpu_ppc64x.go#L9
#[cfg_attr(
any(
target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "powerpc64",
),
repr(align(128))
)]
// arm, mips, mips64, and riscv64 have 32-byte cache l... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | d96bbf04655bc7e40f87967996f0ae8976fe5aae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d96bbf04655bc7e40f87967996f0ae8976fe5aae/tokio/src/runtime/time/entry.rs | 681 | 733 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:19 | target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "powerpc64",
target_arch = "arm",
target_arch = "mips",
target_arch = "mips64",
target_arch = "riscv64",
target_arch = "s390x",
)),
repr(align(64))
)]
#[derive(Debug, Default)]
struct CachePadd... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | d96bbf04655bc7e40f87967996f0ae8976fe5aae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d96bbf04655bc7e40f87967996f0ae8976fe5aae/tokio/src/runtime/time/entry.rs | 721 | 733 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:8 | }
}
/// A timer entry.
///
/// This is the handle to a timer that is controlled by the requester of the
/// timer. As this participates in intrusive data structures, it must be pinned
/// before polling.
#[derive(Debug)]
pub(crate) struct TimerEntry {
/// Arc reference to the runtime handle. We can only free the d... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/entry.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:9 | #[derive(Debug)]
pub(crate) struct TimerHandle {
inner: NonNull<TimerShared>,
}
pub(super) type EntryList = crate::util::linked_list::LinkedList<TimerShared, TimerShared>;
/// The shared state structure of a timer. This structure is shared between the
/// frontend (`Entry`) and driver backend.
///
/// Note that t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/entry.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:10 | }
/// Gets the cached time-of-expiration value.
pub(super) fn cached_when(&self) -> u64 {
// Cached-when is only accessed under the driver lock, so we can use relaxed
self.driver_state.0.cached_when.load(Ordering::Relaxed)
}
/// Gets the true time-of-expiration value, and copies it int... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/entry.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:11 | /// Sets the true time-of-expiration value, even if it is less than the
/// current expiration or the timer is deregistered.
///
/// SAFETY: Must only be called with the driver lock held and the entry not
/// in the timer wheel.
pub(super) unsafe fn set_expiration(&self, t: u64) {
self.state... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/entry.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:12 | pointers: linked_list::Pointers<TimerShared>,
/// The expiration time for which this entry is currently registered.
/// Generally owned by the driver, but is accessed by the entry when not
/// registered.
cached_when: AtomicU64,
/// The true expiration time. Set by the timer future, read by the dr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/entry.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:13 | }
unsafe fn from_raw(ptr: NonNull<Self::Target>) -> Self::Handle {
TimerHandle { inner: ptr }
}
unsafe fn pointers(
target: NonNull<Self::Target>,
) -> NonNull<linked_list::Pointers<Self::Target>> {
TimerShared::addr_of_pointers(target)
}
}
// ===== impl Entry =====
impl ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/entry.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:14 | pub(crate) fn cancel(self: Pin<&mut Self>) {
// We need to perform an acq/rel fence with the driver thread, and the
// simplest way to do so is to grab the driver lock.
//
// Why is this necessary? We're about to release this timer's memory for
// some other non-timer use. Howeve... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/entry.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:15 | pub(crate) fn poll_elapsed(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), super::Error>> {
if self.driver().is_shutdown() {
panic!("{}", crate::util::error::RUNTIME_SHUTTING_DOWN_ERROR);
}
if let Some(deadline) = self.initial_deadline {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/entry.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:16 | /// Forcibly sets the true and cached expiration times to the given tick.
///
/// SAFETY: The caller must ensure that the handle remains valid, the driver
/// lock is held, and that the timer is not in any wheel linked lists.
pub(super) unsafe fn set_expiration(&self, tick: u64) {
self.inner.as_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/entry.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:17 | ///
/// SAFETY: The driver lock must be held while invoking this function, and
/// the entry must not be in any wheel linked lists.
pub(super) unsafe fn fire(self, completed_state: TimerResult) -> Option<Waker> {
self.inner.as_ref().state.fire(completed_state)
}
}
impl Drop for TimerEntry {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/entry.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:18 | // arm, mips, mips64, and riscv64 have 32-byte cache line size.
//
// Sources:
// - https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/internal/cpu/cpu_arm.go#L7
// - https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/internal/cpu/cpu_mips.go#L7
// - https://githu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/time/entry.rs | 681 | 724 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:15 | pub(crate) fn poll_elapsed(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), super::Error>> {
if self.driver().is_shutdown() {
panic!("{}", crate::util::error::RUNTIME_SHUTTING_DOWN_ERROR);
}
if let Some(deadline) = self.initial_deadline {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 7483509746e1d82d7fc3642fd8431116c96aa387 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7483509746e1d82d7fc3642fd8431116c96aa387/tokio/src/runtime/time/entry.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:16 | pub(super) unsafe fn set_expiration(&self, tick: u64) {
self.inner.as_ref().set_expiration(tick);
}
/// Attempts to mark this entry as pending. If the expiration time is after
/// `not_after`, however, returns an Err with the current expiration time.
///
/// If an `Err` is returned, the `ca... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 7483509746e1d82d7fc3642fd8431116c96aa387 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7483509746e1d82d7fc3642fd8431116c96aa387/tokio/src/runtime/time/entry.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:17 | }
}
impl Drop for TimerEntry {
fn drop(&mut self) {
unsafe { Pin::new_unchecked(self) }.as_mut().cancel()
}
}
// Copied from [crossbeam/cache_padded](https://github.com/crossbeam-rs/crossbeam/blob/fa35346b7c789bba045ad789e894c68c466d1779/crossbeam-utils/src/cache_padded.rs#L62-L127)
//
// Starting fro... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 7483509746e1d82d7fc3642fd8431116c96aa387 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7483509746e1d82d7fc3642fd8431116c96aa387/tokio/src/runtime/time/entry.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:18 | // - https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/internal/cpu/cpu_mipsle.go#L7
// - https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/internal/cpu/cpu_mips64x.go#L9
// - https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/interna... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 7483509746e1d82d7fc3642fd8431116c96aa387 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7483509746e1d82d7fc3642fd8431116c96aa387/tokio/src/runtime/time/entry.rs | 681 | 719 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:12 | pointers: linked_list::Pointers<TimerShared>,
/// The expiration time for which this entry is currently registered.
/// Generally owned by the driver, but is accessed by the entry when not
/// registered.
cached_when: AtomicU64,
/// The true expiration time. Set by the timer future, read by the dr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 80568dfc6da83f9c68c63bd9de66bcda295c76a9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/80568dfc6da83f9c68c63bd9de66bcda295c76a9/tokio/src/runtime/time/entry.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:13 | }
unsafe fn from_raw(ptr: NonNull<Self::Target>) -> Self::Handle {
TimerHandle { inner: ptr }
}
unsafe fn pointers(
target: NonNull<Self::Target>,
) -> NonNull<linked_list::Pointers<Self::Target>> {
TimerShared::addr_of_pointers(target)
}
}
// ===== impl Entry =====
impl ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 80568dfc6da83f9c68c63bd9de66bcda295c76a9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/80568dfc6da83f9c68c63bd9de66bcda295c76a9/tokio/src/runtime/time/entry.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:14 | pub(crate) fn cancel(self: Pin<&mut Self>) {
// We need to perform an acq/rel fence with the driver thread, and the
// simplest way to do so is to grab the driver lock.
//
// Why is this necessary? We're about to release this timer's memory for
// some other non-timer use. Howeve... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 80568dfc6da83f9c68c63bd9de66bcda295c76a9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/80568dfc6da83f9c68c63bd9de66bcda295c76a9/tokio/src/runtime/time/entry.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:15 | pub(crate) fn poll_elapsed(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), super::Error>> {
if self.driver().is_shutdown() {
panic!("{}", crate::util::error::RUNTIME_SHUTTING_DOWN_ERROR);
}
if let Some(deadline) = self.initial_deadline {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 80568dfc6da83f9c68c63bd9de66bcda295c76a9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/80568dfc6da83f9c68c63bd9de66bcda295c76a9/tokio/src/runtime/time/entry.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:14 | pub(crate) fn cancel(self: Pin<&mut Self>) {
// We need to perform an acq/rel fence with the driver thread, and the
// simplest way to do so is to grab the driver lock.
//
// Why is this necessary? We're about to release this timer's memory for
// some other non-timer use. Howeve... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 00082c668fefdba8a373720b54adfbbe514b7196 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00082c668fefdba8a373720b54adfbbe514b7196/tokio/src/runtime/time/entry.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:15 | pub(crate) fn poll_elapsed(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), super::Error>> {
if self.driver().is_shutdown() {
panic!("{}", crate::util::error::RUNTIME_SHUTTING_DOWN_ERROR);
}
if let Some(deadline) = self.initial_deadline {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 00082c668fefdba8a373720b54adfbbe514b7196 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00082c668fefdba8a373720b54adfbbe514b7196/tokio/src/runtime/time/entry.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:4 | fn is_pending(&self) -> bool {
self.state.load(Ordering::Relaxed) == STATE_PENDING_FIRE
}
/// Returns the current expiration time, or None if not currently scheduled.
fn when(&self) -> Option<u64> {
let cur_state = self.state.load(Ordering::Relaxed);
if cur_state == u64::MAX {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:5 | /// time is not after `not_after`.
///
/// If the timer is scheduled for a time after not_after, returns an Err
/// containing the current scheduled time.
///
/// SAFETY: Must hold the driver lock.
unsafe fn mark_pending(&self, not_after: u64) -> Result<(), u64> {
// Quick initial debug ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:6 | /// driver lock is released
/// * `None` - if fired and a waker does not need to be invoked, or if
/// already fired
///
/// SAFETY: The driver lock must be held.
unsafe fn fire(&self, result: TimerResult) -> Option<Waker> {
// Quick initial check to see if the timer is already fired. Si... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:7 | /// Attempts to adjust the timer to a new timestamp.
///
/// If the timer has already been fired, is pending firing, or the new
/// timestamp is earlier than the old timestamp, (or occasionally
/// spuriously) returns Err without changing the timer's state. In this
/// case, the timer must be deregi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:8 | /// This is the handle to a timer that is controlled by the requester of the
/// timer. As this participates in intrusive data structures, it must be pinned
/// before polling.
#[derive(Debug)]
pub(crate) struct TimerEntry {
/// Arc reference to the runtime handle. We can only free the driver after
/// deregist... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:9 | pub(super) type EntryList = crate::util::linked_list::LinkedList<TimerShared, TimerShared>;
/// The shared state structure of a timer. This structure is shared between the
/// frontend (`Entry`) and driver backend.
///
/// Note that this structure is located inside the `TimerEntry` structure.
#[derive(Debug)]
#[repr(C... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:10 | self.driver_state.0.cached_when.load(Ordering::Relaxed)
}
/// Gets the true time-of-expiration value, and copies it into the cached
/// time-of-expiration value.
///
/// SAFETY: Must be called with the driver lock held, and when this entry is
/// not in any timer wheel lists.
pub(super) uns... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:11 | pub(super) unsafe fn set_expiration(&self, t: u64) {
self.state.set_expiration(t);
self.driver_state.0.cached_when.store(t, Ordering::Relaxed);
}
/// Sets the true time-of-expiration only if it is after the current.
pub(super) fn extend_expiration(&self, t: u64) -> Result<(), ()> {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:12 | cached_when: AtomicU64,
/// The true expiration time. Set by the timer future, read by the driver.
true_when: AtomicU64,
}
impl std::fmt::Debug for TimerSharedPadded {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("TimerSharedPadded")
.field("when"... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:13 | unsafe fn pointers(
target: NonNull<Self::Target>,
) -> NonNull<linked_list::Pointers<Self::Target>> {
TimerShared::addr_of_pointers(target)
}
}
// ===== impl Entry =====
impl TimerEntry {
#[track_caller]
pub(crate) fn new(handle: &scheduler::Handle, deadline: Instant) -> Self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:14 | // some other non-timer use. However, we've been doing a bunch of
// relaxed (or even non-atomic) writes from the driver thread, and we'll
// be doing more from _this thread_ (as this memory is interpreted as
// something else).
//
// It is critical to ensure that, from the point... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:15 | if self.driver().is_shutdown() {
panic!("{}", crate::util::error::RUNTIME_SHUTTING_DOWN_ERROR);
}
if let Some(deadline) = self.initial_deadline {
self.as_mut().reset(deadline);
}
let this = unsafe { self.get_unchecked_mut() };
this.inner().state.poll(cx... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:16 | /// `not_after`, however, returns an Err with the current expiration time.
///
/// If an `Err` is returned, the `cached_when` value will be updated to this
/// new expiration time.
///
/// SAFETY: The caller must ensure that the handle remains valid, the driver
/// lock is held, and that the tim... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:17 | unsafe { Pin::new_unchecked(self) }.as_mut().cancel()
}
}
// Copied from [crossbeam/cache_padded](https://github.com/crossbeam-rs/crossbeam/blob/fa35346b7c789bba045ad789e894c68c466d1779/crossbeam-utils/src/cache_padded.rs#L62-L127)
//
// Starting from Intel's Sandy Bridge, spatial prefetcher is now pulling pairs o... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:18 | target_arch = "arm",
target_arch = "mips",
target_arch = "mips64",
target_arch = "riscv64",
),
repr(align(32))
)]
// s390x has 256-byte cache line size.
//
// Sources:
// - https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/internal/cpu/cpu_s390x.go#L7
#[cfg_a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 607816491d88a58e27dc4d03a9a484a6feb926b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/607816491d88a58e27dc4d03a9a484a6feb926b3/tokio/src/runtime/time/entry.rs | 681 | 714 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:16 | /// `not_after`, however, returns an Err with the current expiration time.
///
/// If an `Err` is returned, the `cached_when` value will be updated to this
/// new expiration time.
///
/// SAFETY: The caller must ensure that the handle remains valid, the driver
/// lock is held, and that the tim... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | ebeb78ed40027032feb77c89a1de4b58d2dcafbf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebeb78ed40027032feb77c89a1de4b58d2dcafbf/tokio/src/runtime/time/entry.rs | 601 | 648 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:2 | //! walking lists of timers), it checks this "true when" value, and reschedules
//! based on it.
//!
//! We do, however, also need to track what the expiration time was when we
//! originally registered the timer; this is used to locate the right linked
//! list when the timer is being cancelled. This is referred to as... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/entry.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:7 | /// Attempts to adjust the timer to a new timestamp.
///
/// If the timer has already been fired, is pending firing, or the new
/// timestamp is earlier than the old timestamp, (or occasionally
/// spuriously) returns Err without changing the timer's state. In this
/// case, the timer must be deregi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/entry.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:8 | /// This is the handle to a timer that is controlled by the requester of the
/// timer. As this participates in intrusive data structures, it must be pinned
/// before polling.
#[derive(Debug)]
pub(crate) struct TimerEntry {
/// Arc reference to the runtime handle. We can only free the driver after
/// deregist... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/entry.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:12 | cached_when: AtomicU64,
/// The true expiration time. Set by the timer future, read by the driver.
true_when: AtomicU64,
}
impl std::fmt::Debug for TimerSharedPadded {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("TimerSharedPadded")
.field("when"... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/entry.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:13 | unsafe fn pointers(
target: NonNull<Self::Target>,
) -> NonNull<linked_list::Pointers<Self::Target>> {
TimerShared::addr_of_pointers(target)
}
}
// ===== impl Entry =====
impl TimerEntry {
#[track_caller]
pub(crate) fn new(handle: &Handle, deadline: Instant) -> Self {
// Panic ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/entry.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:14 | // some other non-timer use. However, we've been doing a bunch of
// relaxed (or even non-atomic) writes from the driver thread, and we'll
// be doing more from _this thread_ (as this memory is interpreted as
// something else).
//
// It is critical to ensure that, from the point... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/entry.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:15 | if self.driver().is_shutdown() {
panic!("{}", crate::util::error::RUNTIME_SHUTTING_DOWN_ERROR);
}
if let Some(deadline) = self.initial_deadline {
self.as_mut().reset(deadline);
}
let this = unsafe { self.get_unchecked_mut() };
this.inner().state.poll(cx... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/entry.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:16 | /// Attempts to mark this entry as pending. If the expiration time is after
/// `not_after`, however, returns an Err with the current expiration time.
///
/// If an `Err` is returned, the `cached_when` value will be updated to this
/// new expiration time.
///
/// SAFETY: The caller must ensure ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 9e0275977981356fc5618b2061cdac8eb39a9569 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/time/entry.rs | 601 | 649 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:14 | // some other non-timer use. However, we've been doing a bunch of
// relaxed (or even non-atomic) writes from the driver thread, and we'll
// be doing more from _this thread_ (as this memory is interpreted as
// something else).
//
// It is critical to ensure that, from the point... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 3f379abda4f980086ab44f4912eff877bdb75120 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f379abda4f980086ab44f4912eff877bdb75120/tokio/src/runtime/time/entry.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:15 | if self.driver().is_shutdown() {
panic!("{}", crate::util::error::RUNTIME_SHUTTING_DOWN_ERROR);
}
if let Some(deadline) = self.initial_deadline {
self.as_mut().reset(deadline);
}
let this = unsafe { self.get_unchecked_mut() };
this.inner().state.poll(cx... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 3f379abda4f980086ab44f4912eff877bdb75120 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f379abda4f980086ab44f4912eff877bdb75120/tokio/src/runtime/time/entry.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:14 | // some other non-timer use. However, we've been doing a bunch of
// relaxed (or even non-atomic) writes from the driver thread, and we'll
// be doing more from _this thread_ (as this memory is interpreted as
// something else).
//
// It is critical to ensure that, from the point... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/entry.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/time/entry.rs:15 | panic!("{}", crate::util::error::RUNTIME_SHUTTING_DOWN_ERROR);
}
if let Some(deadline) = self.initial_deadline {
self.as_mut().reset(deadline);
}
let this = unsafe { self.get_unchecked_mut() };
this.inner().state.poll(cx.waker())
}
fn driver(&self) -> &sup... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/entry.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/entry.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/time/handle.rs:1 | use crate::runtime::time::TimeSource;
use std::fmt;
/// Handle to time driver instance.
pub(crate) struct Handle {
pub(super) time_source: TimeSource,
pub(super) inner: super::Inner,
}
impl Handle {
/// Returns the time source associated with this handle.
pub(crate) fn time_source(&self) -> &TimeSourc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/handle.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/handle.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/handle.rs:2 | ///
/// This function panics if there is no current timer set.
///
/// It can be triggered when [`Builder::enable_time`] or
/// [`Builder::enable_all`] are not included in the builder.
///
/// It can also panic whenever a timer is created outside of a
/// Tokio ru... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/handle.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/handle.rs | 41 | 68 |
tokio-rs/tokio:tokio/src/runtime/time/handle.rs:1 | use crate::runtime::time::TimeSource;
use std::fmt;
/// Handle to time driver instance.
pub(crate) struct Handle {
pub(super) time_source: TimeSource,
pub(super) inner: super::Inner,
}
impl Handle {
/// Returns the time source associated with this handle.
pub(crate) fn time_source(&self) -> &TimeSourc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/handle.rs | MIT | 80568dfc6da83f9c68c63bd9de66bcda295c76a9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/80568dfc6da83f9c68c63bd9de66bcda295c76a9/tokio/src/runtime/time/handle.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/handle.rs:2 | /// It can also panic whenever a timer is created outside of a
/// Tokio runtime. That is why `rt.block_on(sleep(...))` will panic,
/// since the function is executed outside of the runtime.
/// Whereas `rt.block_on(async {sleep(...).await})` doesn't panic.
/// And this is because wrappi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/handle.rs | MIT | 80568dfc6da83f9c68c63bd9de66bcda295c76a9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/80568dfc6da83f9c68c63bd9de66bcda295c76a9/tokio/src/runtime/time/handle.rs | 41 | 62 |
tokio-rs/tokio:tokio/src/runtime/time/handle.rs:1 | use crate::loom::sync::Arc;
use crate::runtime::time::TimeSource;
use std::fmt;
/// Handle to time driver instance.
#[derive(Clone)]
pub(crate) struct Handle {
time_source: TimeSource,
pub(super) inner: Arc<super::Inner>,
}
impl Handle {
/// Creates a new timer `Handle` from a shared `Inner` timer state.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/handle.rs | MIT | 0b92f80a6506c6a89eb998e5f61a33415353bba1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/runtime/time/handle.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/handle.rs:2 | }
cfg_not_rt! {
impl Handle {
/// Tries to get a handle to the current timer.
///
/// # Panics
///
/// This function panics if there is no current timer set.
///
/// It can be triggered when [`Builder::enable_time`] or
/// [`Builder::enable_all`] are ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/handle.rs | MIT | 0b92f80a6506c6a89eb998e5f61a33415353bba1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/runtime/time/handle.rs | 41 | 75 |
tokio-rs/tokio:tokio/src/runtime/time/handle.rs:1 | use crate::loom::sync::Arc;
use crate::runtime::time::TimeSource;
use std::fmt;
/// Handle to time driver instance.
#[derive(Clone)]
pub(crate) struct Handle {
time_source: TimeSource,
pub(super) inner: Arc<super::Inner>,
}
impl Handle {
/// Creates a new timer `Handle` from a shared `Inner` timer state.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/handle.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/handle.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/handle.rs:2 | /// This function panics if there is no current timer set.
///
/// It can be triggered when [`Builder::enable_time`] or
/// [`Builder::enable_all`] are not included in the builder.
///
/// It can also panic whenever a timer is created outside of a
/// Tokio runtime. That ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/handle.rs | MIT | 588408c06000313f7b4f31c225d3635e9b012e3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/time/handle.rs | 41 | 67 |
tokio-rs/tokio:tokio/src/runtime/time/handle.rs:1 | use crate::loom::sync::Arc;
use crate::runtime::time::TimeSource;
use std::fmt;
/// Handle to time driver instance.
#[derive(Clone)]
pub(crate) struct Handle {
time_source: TimeSource,
pub(super) inner: Arc<super::Inner>,
}
impl Handle {
/// Creates a new timer `Handle` from a shared `Inner` timer state.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/handle.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/handle.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/handle.rs:2 | /// This function panics if there is no current timer set.
///
/// It can be triggered when [`Builder::enable_time`] or
/// [`Builder::enable_all`] are not included in the builder.
///
/// It can also panic whenever a timer is created outside of a
/// Tokio runtime. That ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/handle.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/handle.rs | 41 | 96 |
tokio-rs/tokio:tokio/src/runtime/time/handle.rs:3 | /// panicking.
///
/// [`Builder::enable_time`]: crate::runtime::Builder::enable_time
/// [`Builder::enable_all`]: crate::runtime::Builder::enable_all
#[track_caller]
pub(crate) fn current() -> Self {
panic!("{}", crate::util::error::CONTEXT_MISSING_ERROR)
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/handle.rs | MIT | 2ad347465e8b634b785e7637d899a14da8a0fba3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ad347465e8b634b785e7637d899a14da8a0fba3/tokio/src/runtime/time/handle.rs | 81 | 96 |
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 | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:3 | /// down. Eventually, as time progresses, entries with [`Sleep`][sleep] instances will
/// either be canceled (dropped) or their associated entries will reach level
/// zero and be notified.
///
/// [paper]: http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf
/// [sleep]: crate::time::Sleep
/// [time... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:4 | //
// While it may look racy, it only has any effect when the clock is paused
// and pausing the clock is restricted to a single-threaded runtime.
#[cfg(feature = "test-util")]
did_wake: AtomicBool,
},
}
/// Time state shared which must be protected by a `Mutex`
struct InnerState {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:5 | let driver = Driver { park };
(driver, handle)
}
#[cfg(all(tokio_unstable, feature = "rt-multi-thread"))]
pub(crate) fn new_alt(clock: &Clock) -> Handle {
let time_source = TimeSource::new(clock);
Handle {
time_source,
inner: Inner::Alternative {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:6 | Inner::Alternative { is_shutdown, .. } => {
is_shutdown.store(true, Ordering::SeqCst);
}
}
// Advance time forward to the end of time.
handle.process_at_time(u64::MAX);
self.park.shutdown(rt_handle);
}
fn park_internal(&mut self, rt_handle: &driver... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:7 | } else {
self.park.park_timeout(rt_handle, Duration::from_secs(0));
}
}
None => {
if let Some(duration) = limit {
self.park_thread_timeout(rt_handle, duration);
} else {
self.park.park(rt_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:8 | cfg_not_test_util! {
fn park_thread_timeout(&mut self, rt_handle: &driver::Handle, duration: Duration) {
self.park.park_timeout(rt_handle, duration);
}
}
}
impl Handle {
pub(self) fn process(&self, clock: &Clock) {
let now = self.time_source().now(clock);
self.proce... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:9 | waker_list.wake_all();
lock = self.inner.lock();
}
}
}
lock.next_wake = lock
.wheel
.poll_at()
.map(|t| NonZeroU64::new(t).unwrap_or_else(|| NonZeroU64::new(1).unwrap()));
drop(lock);
waker_list.wake_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:10 | // self.is_shutdown.store(true, Ordering::SeqCst);
// Advance time forward to the end of time.
// This will ensure that all timers are fired.
let max_tick = u64::MAX;
let mut wake_queue = time_alt::WakeQueue::new();
self.process_at_time_alt(wheel, max_tick, &mut wake_queue);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:11 | new_tick: u64,
entry: NonNull<TimerShared>,
) {
let waker = unsafe {
let mut lock = self.inner.lock();
// We may have raced with a firing/deregistration, so check before
// deregistering.
if unsafe { entry.as_ref().might_be_registered() } {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:12 | // 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 the task won't be awoken to poll again.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 441 | 493 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:13 | Inner::Alternative { is_shutdown, .. } => 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 | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/time/mod.rs | 481 | 493 |
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 | 9563707aaa73a802fa4d3c51c12869a037641070 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9563707aaa73a802fa4d3c51c12869a037641070/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 {
/// Parker to delegate to.
park: IoStack,
}
/// Timer state shared betwee... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 9563707aaa73a802fa4d3c51c12869a037641070 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9563707aaa73a802fa4d3c51c12869a037641070/tokio/src/runtime/time/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:4 | impl Driver {
/// Creates a new `Driver` instance that uses `park` to block the current
/// thread and `time_source` to get the current time and convert to ticks.
///
/// Specifying the source of time is useful when testing.
pub(crate) fn new(park: IoStack, clock: &Clock) -> (Driver, Handle) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 9563707aaa73a802fa4d3c51c12869a037641070 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9563707aaa73a802fa4d3c51c12869a037641070/tokio/src/runtime/time/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:5 | }
handle.inner.is_shutdown.store(true, Ordering::SeqCst);
// Advance time forward to the end of time.
handle.process_at_time(u64::MAX);
self.park.shutdown(rt_handle);
}
fn park_internal(&mut self, rt_handle: &driver::Handle, limit: Option<Duration>) {
let handle = rt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 9563707aaa73a802fa4d3c51c12869a037641070 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9563707aaa73a802fa4d3c51c12869a037641070/tokio/src/runtime/time/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:6 | self.park.park_timeout(rt_handle, Duration::from_secs(0));
}
}
None => {
if let Some(duration) = limit {
self.park_thread_timeout(rt_handle, duration);
} else {
self.park.park(rt_handle);
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 9563707aaa73a802fa4d3c51c12869a037641070 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9563707aaa73a802fa4d3c51c12869a037641070/tokio/src/runtime/time/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:7 | cfg_not_test_util! {
fn park_thread_timeout(&mut self, rt_handle: &driver::Handle, duration: Duration) {
self.park.park_timeout(rt_handle, duration);
}
}
}
impl Handle {
pub(self) fn process(&self, clock: &Clock) {
let now = self.time_source().now(clock);
self.proce... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 9563707aaa73a802fa4d3c51c12869a037641070 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9563707aaa73a802fa4d3c51c12869a037641070/tokio/src/runtime/time/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:8 | waker_list.wake_all();
lock = self.inner.lock();
}
}
}
lock.next_wake = lock
.wheel
.poll_at()
.map(|t| NonZeroU64::new(t).unwrap_or_else(|| NonZeroU64::new(1).unwrap()));
drop(lock);
waker_list.wake_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 9563707aaa73a802fa4d3c51c12869a037641070 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9563707aaa73a802fa4d3c51c12869a037641070/tokio/src/runtime/time/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:9 | ///
/// 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,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 9563707aaa73a802fa4d3c51c12869a037641070 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9563707aaa73a802fa4d3c51c12869a037641070/tokio/src/runtime/time/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:10 | None
}
Err((entry, crate::time::error::InsertError::Elapsed)) => unsafe {
entry.fire(Ok(()))
},
}
}
// Must release lock before invoking waker to avoid the risk of deadlock.
};
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 9563707aaa73a802fa4d3c51c12869a037641070 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9563707aaa73a802fa4d3c51c12869a037641070/tokio/src/runtime/time/mod.rs | 361 | 409 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:6 | self.park.park_timeout(rt_handle, Duration::from_secs(0));
}
}
None => {
if let Some(duration) = limit {
self.park_thread_timeout(rt_handle, duration);
} else {
self.park.park(rt_handle);
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 4cbcb687f429f2a4cee948b0462e23f86ef95822 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cbcb687f429f2a4cee948b0462e23f86ef95822/tokio/src/runtime/time/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:7 | cfg_not_test_util! {
fn park_thread_timeout(&mut self, rt_handle: &driver::Handle, duration: Duration) {
self.park.park_timeout(rt_handle, duration);
}
}
}
impl Handle {
/// Runs timer related logic, and returns the next wakeup time
pub(self) fn process(&self, clock: &Clock) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 4cbcb687f429f2a4cee948b0462e23f86ef95822 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cbcb687f429f2a4cee948b0462e23f86ef95822/tokio/src/runtime/time/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:9 | /// Removes and re-adds an entry to the driver.
///
/// 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`)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 4cbcb687f429f2a4cee948b0462e23f86ef95822 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cbcb687f429f2a4cee948b0462e23f86ef95822/tokio/src/runtime/time/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:10 | }
None
}
Err((entry, crate::time::error::InsertError::Elapsed)) => unsafe {
entry.fire(Ok(()))
},
}
}
// Must release lock before invoking waker to avoid the risk of dead... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 4cbcb687f429f2a4cee948b0462e23f86ef95822 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cbcb687f429f2a4cee948b0462e23f86ef95822/tokio/src/runtime/time/mod.rs | 361 | 410 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:11 | }
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 | 4cbcb687f429f2a4cee948b0462e23f86ef95822 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cbcb687f429f2a4cee948b0462e23f86ef95822/tokio/src/runtime/time/mod.rs | 401 | 410 |
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 {
/// Parker to delegate to.
park: IoStack,
}
/// Timer state shared betwee... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/time/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:4 | impl Driver {
/// Creates a new `Driver` instance that uses `park` to block the current
/// thread and `time_source` to get the current time and convert to ticks.
///
/// Specifying the source of time is useful when testing.
pub(crate) fn new(park: IoStack, clock: &Clock) -> (Driver, Handle) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/time/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:5 | }
handle.inner.is_shutdown.store(true, Ordering::SeqCst);
// Advance time forward to the end of time.
handle.process_at_time(u64::MAX);
self.park.shutdown(rt_handle);
}
fn park_internal(&mut self, rt_handle: &driver::Handle, limit: Option<Duration>) {
let handle = rt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | 1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/time/mod.rs | 161 | 220 |
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 | bd4ccae184b0359cb88f9ebc2ba157867e1eee0e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd4ccae184b0359cb88f9ebc2ba157867e1eee0e/tokio/src/runtime/time/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:3 | /// levels go up, the slots of the associated wheel represent larger intervals
/// of time. At each level, the wheel has 64 slots. Each slot covers a range of
/// time equal to the wheel at the lower level. At level zero, each slot
/// represents one millisecond of time.
///
/// The wheels are:
///
/// * Level 0: 64 x ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | bd4ccae184b0359cb88f9ebc2ba157867e1eee0e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd4ccae184b0359cb88f9ebc2ba157867e1eee0e/tokio/src/runtime/time/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:4 | wheels_len: u32,
/// True if the driver is being shutdown.
pub(super) is_shutdown: AtomicBool,
// When `true`, a call to `park_timeout` should immediately return and time
// should not advance. One reason for this to be `true` is if the task
// passed to `Runtime::block_on` called `task::yield_now... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | bd4ccae184b0359cb88f9ebc2ba157867e1eee0e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd4ccae184b0359cb88f9ebc2ba157867e1eee0e/tokio/src/runtime/time/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:5 | #[cfg(feature = "test-util")]
did_wake: AtomicBool::new(false),
},
};
let driver = Driver { park };
(driver, handle)
}
pub(crate) fn park(&mut self, handle: &driver::Handle) {
self.park_internal(handle, None);
}
pub(crate) fn park_timeout(&... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | bd4ccae184b0359cb88f9ebc2ba157867e1eee0e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd4ccae184b0359cb88f9ebc2ba157867e1eee0e/tokio/src/runtime/time/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:6 | let mut wheels_lock = rt_handle.time().inner.wheels.write();
let expiration_time = wheels_lock
.0
.iter_mut()
.filter_map(|wheel| wheel.get_mut().next_expiration_time())
.min();
rt_handle
.time()
.in... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | bd4ccae184b0359cb88f9ebc2ba157867e1eee0e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd4ccae184b0359cb88f9ebc2ba157867e1eee0e/tokio/src/runtime/time/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:7 | self.park.park(rt_handle);
}
}
}
// Process pending timers after waking up
handle.process(rt_handle.clock());
}
cfg_test_util! {
fn park_thread_timeout(&mut self, rt_handle: &driver::Handle, duration: Duration) {
let handle = rt_handle.ti... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | bd4ccae184b0359cb88f9ebc2ba157867e1eee0e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd4ccae184b0359cb88f9ebc2ba157867e1eee0e/tokio/src/runtime/time/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:8 | // Helper function to turn expiration_time into next_wake_time.
// Since the `park_timeout` will round up to 1ms for avoiding very
// short-duration microsecond-resolution sleeps, we do the same here.
// The conversion is as follows
// None => None
// Some(0) => Some(1)
// Some(i) => Some(i)
fn next_wake_time(expiratio... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | bd4ccae184b0359cb88f9ebc2ba157867e1eee0e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd4ccae184b0359cb88f9ebc2ba157867e1eee0e/tokio/src/runtime/time/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:9 | let mut wheels_lock = self.inner.wheels.read();
let mut lock = wheels_lock.lock_sharded_wheel(id);
if now < lock.elapsed() {
// Time went backwards! This normally shouldn't happen as the Rust language
// guarantees that an Instant is monotonic, but can happen when running
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | bd4ccae184b0359cb88f9ebc2ba157867e1eee0e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd4ccae184b0359cb88f9ebc2ba157867e1eee0e/tokio/src/runtime/time/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/time/mod.rs:10 | /// 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-op.
///
/// This function always acquires the driver lock, even if the entry does
/// not appear to b... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/time/mod.rs | MIT | bd4ccae184b0359cb88f9ebc2ba157867e1eee0e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd4ccae184b0359cb88f9ebc2ba157867e1eee0e/tokio/src/runtime/time/mod.rs | 361 | 420 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.