id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/src/time/driver/entry.rs:4
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_value() { None } else { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
a08ce0d3e06d650361283dc87c8fe14b146df15d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a08ce0d3e06d650361283dc87c8fe14b146df15d/tokio/src/time/driver/entry.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/entry.rs:7
/// /// 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 deregistered and re-registered. fn extend_expiration(&self,...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
a08ce0d3e06d650361283dc87c8fe14b146df15d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a08ce0d3e06d650361283dc87c8fe14b146df15d/tokio/src/time/driver/entry.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/entry.rs:15
pub(super) unsafe fn cached_when(&self) -> u64 { unsafe { self.inner.as_ref().cached_when() } } pub(super) unsafe fn sync_when(&self) -> u64 { unsafe { self.inner.as_ref().sync_when() } } pub(super) unsafe fn is_pending(&self) -> bool { unsafe { self.inner.as_ref().state.is_pen...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
a08ce0d3e06d650361283dc87c8fe14b146df15d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a08ce0d3e06d650361283dc87c8fe14b146df15d/tokio/src/time/driver/entry.rs
561
620
tokio-rs/tokio:tokio/src/time/driver/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/time/driver/entry.rs
MIT
724ba348d1754deb29efa70852d0a745f3b0d90e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/724ba348d1754deb29efa70852d0a745f3b0d90e/tokio/src/time/driver/entry.rs
41
100
tokio-rs/tokio:tokio/src/time/driver/entry.rs:3
/// holding the timer driver lock. The write actions on the StateCell amount to /// passing "ownership" of the StateCell between these contexts; moving a timer /// from the TimerEntry to the driver requires _both_ holding the &mut /// TimerEntry and the driver lock, while moving it back (firing the timer) /// requires ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
724ba348d1754deb29efa70852d0a745f3b0d90e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/724ba348d1754deb29efa70852d0a745f3b0d90e/tokio/src/time/driver/entry.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/entry.rs:14
// the lock and be sure that this drop happens-after everything the // driver did so far and happens-before everything the driver does in // the future. While we have the lock held, we also go ahead and // deregister the entry if necessary. unsafe { self.driver.clear_entry(NonNull::from(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
c39d9867bb989396bb02e74d87f2805969f43f03
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c39d9867bb989396bb02e74d87f2805969f43f03/tokio/src/time/driver/entry.rs
521
580
tokio-rs/tokio:tokio/src/time/driver/entry.rs:14
// the lock and be sure that this drop happens-after everything the // driver did so far and happens-before everything the driver does in // the future. While we have the lock held, we also go ahead and // deregister the entry if necessary. unsafe { self.driver.clear_entry(NonNull::from(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
770044caa70465fbe5d2851a8d9a0bc0e5e7429a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/770044caa70465fbe5d2851a8d9a0bc0e5e7429a/tokio/src/time/driver/entry.rs
521
580
tokio-rs/tokio:tokio/src/time/driver/entry.rs:15
pub(super) unsafe fn sync_when(&self) -> u64 { unsafe { self.inner.as_ref().sync_when() } } pub(super) unsafe fn is_pending(&self) -> bool { unsafe { self.inner.as_ref().state.is_pending() } } /// Forcibly sets the true and cached expiration times to the given tick. /// /// SAF...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
770044caa70465fbe5d2851a8d9a0bc0e5e7429a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/770044caa70465fbe5d2851a8d9a0bc0e5e7429a/tokio/src/time/driver/entry.rs
561
620
tokio-rs/tokio:tokio/src/time/driver/entry.rs:16
/// terminal state, does nothing. /// /// Because the entry might be dropped after the state is moved to a /// terminal state, this function consumes the handle to ensure we don't /// access the entry afterwards. /// /// Returns the last-registered waker, if any. /// /// SAFETY: The driv...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
770044caa70465fbe5d2851a8d9a0bc0e5e7429a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/770044caa70465fbe5d2851a8d9a0bc0e5e7429a/tokio/src/time/driver/entry.rs
601
625
tokio-rs/tokio:tokio/src/time/driver/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/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
41
100
tokio-rs/tokio:tokio/src/time/driver/entry.rs:3
not(tokio_force_time_entry_locked), any(target_arch = "x86", target_pointer_width = "64") ))] type AtomicU64 = crate::loom::sync::atomic::AtomicU64; #[cfg(not(all( not(tokio_force_time_entry_locked), any(target_arch = "x86", target_pointer_width = "64") )))] #[derive(Debug)] struct AtomicU64 { inner: c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/entry.rs:4
_failure: Ordering, ) -> Result<u64, u64> { debug_assert_ne!(_success, Ordering::SeqCst); // we only provide AcqRel with the lock debug_assert_ne!(_failure, Ordering::SeqCst); let mut lock = self.inner.lock(); if *lock == current { *lock = new; Ok(current) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/entry.rs:5
state: AtomicU64, /// If the timer is fired (an Acquire order read on state shows /// `u64::max_value()`), holds the result that should be returned from /// polling the timer. Otherwise, the contents are unspecified and reading /// without holding the driver lock is undefined behavior. result: Unsaf...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/entry.rs:6
None } else { Some(cur_state) } } /// If the timer is completed, returns the result of the timer. Otherwise, /// returns None and registers the waker. fn poll(&self, waker: &Waker) -> Poll<TimerResult> { // We must register first. This ensures that either `fire` will...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/entry.rs:7
// we shouldn't be able to "miss" a transition to a fired state, even // with relaxed ordering. let mut cur_state = self.state.load(Ordering::Relaxed); loop { debug_assert!(cur_state < STATE_MIN_VALUE); if cur_state > not_after { break Err(cur_state); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/entry.rs:8
// with relaxed ordering. let cur_state = self.state.load(Ordering::Relaxed); if cur_state == STATE_DEREGISTERED { return None; } // SAFETY: We assume the driver lock is held and the timer is not // fired, so only the driver is accessing this field. // ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/entry.rs:9
if new_timestamp < prior || prior >= STATE_MIN_VALUE { return Err(()); } match self.state.compare_exchange_weak( prior, new_timestamp, Ordering::AcqRel, Ordering::Acquire, ) { Ok(_) => { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/entry.rs:10
/// therefore other references can exist to it while mutable references to /// Entry exist. /// /// This is manipulated only under the inner mutex. TODO: Can we use loom /// cells for this? inner: StdUnsafeCell<TimerShared>, /// Initial deadline for the timer. This is used to register on the fir...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
361
420
tokio-rs/tokio:tokio/src/time/driver/entry.rs:11
/// the ownership of the driver, and if not, its current state (not /// complete, fired, error, etc). state: StateCell, /// Data manipulated by the driver thread itself, only. driver_state: CachePadded<TimerSharedPadded>, _p: PhantomPinned, } impl TimerShared { pub(super) fn new() -> Self { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
401
460
tokio-rs/tokio:tokio/src/time/driver/entry.rs:12
/// Sets 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. unsafe fn set_cached_when(&self, when: u64) { self.driver_state .0 .cached_when .store(when, Orderi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
441
500
tokio-rs/tokio:tokio/src/time/driver/entry.rs:13
/// be registered with the driver. This check is performed with relaxed /// ordering, but is conservative - if it returns false, the timer is /// definitely _not_ registered. pub(super) fn might_be_registered(&self) -> bool { self.state.might_be_registered() } } /// Additional shared state betw...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
481
540
tokio-rs/tokio:tokio/src/time/driver/entry.rs:14
cached_when: AtomicU64::new(0), true_when: AtomicU64::new(0), pointers: StdUnsafeCell::new(linked_list::Pointers::new()), } } } unsafe impl Send for TimerShared {} unsafe impl Sync for TimerShared {} unsafe impl linked_list::Link for TimerShared { type Handle = TimerHandle; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
521
580
tokio-rs/tokio:tokio/src/time/driver/entry.rs:15
_m: std::marker::PhantomPinned, } } fn inner(&self) -> &TimerShared { unsafe { &*self.inner.get() } } pub(crate) fn is_elapsed(&self) -> bool { !self.inner().state.might_be_registered() && self.initial_deadline.is_none() } /// Cancels and deregisters the timer. This op...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
561
620
tokio-rs/tokio:tokio/src/time/driver/entry.rs:16
unsafe { self.as_mut().get_unchecked_mut() }.initial_deadline = None; let tick = self.driver.time_source().deadline_to_tick(new_time); if self.inner().extend_expiration(tick).is_ok() { return; } unsafe { self.driver.reregister(tick, self.inner().into()); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
601
660
tokio-rs/tokio:tokio/src/time/driver/entry.rs:17
/// 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/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
641
697
tokio-rs/tokio:tokio/src/time/driver/entry.rs:18
/// 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 { fn drop...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d74d17307dd53215061c4a8a1f20a0e30461e296
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d74d17307dd53215061c4a8a1f20a0e30461e296/tokio/src/time/driver/entry.rs
681
697
tokio-rs/tokio:tokio/src/time/driver/entry.rs:9
if new_timestamp < prior || prior >= STATE_MIN_VALUE { return Err(()); } match self.state.compare_exchange_weak( prior, new_timestamp, Ordering::AcqRel, Ordering::Acquire, ) { Ok(_) => { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
9706ca92a8deb69d6e29265f21424042fea966c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9706ca92a8deb69d6e29265f21424042fea966c5/tokio/src/time/driver/entry.rs
321
380
tokio-rs/tokio:tokio/src/time/driver/entry.rs:10
/// therefore other references can exist to it while mutable references to /// Entry exist. /// /// This is manipulated only under the inner mutex. TODO: Can we use loom /// cells for this? inner: StdUnsafeCell<TimerShared>, /// Initial deadline for the timer. This is used to register on the fir...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
9706ca92a8deb69d6e29265f21424042fea966c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9706ca92a8deb69d6e29265f21424042fea966c5/tokio/src/time/driver/entry.rs
361
420
tokio-rs/tokio:tokio/src/time/driver/entry.rs:11
state: StateCell, /// Data manipulated by the driver thread itself, only. driver_state: CachePadded<TimerSharedPadded>, _p: PhantomPinned, } impl TimerShared { pub(super) fn new() -> Self { Self { state: StateCell::default(), driver_state: CachePadded(TimerSharedPadded...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
9706ca92a8deb69d6e29265f21424042fea966c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9706ca92a8deb69d6e29265f21424042fea966c5/tokio/src/time/driver/entry.rs
401
460
tokio-rs/tokio:tokio/src/time/driver/entry.rs:12
/// /// SAFETY: Must be called with the driver lock held, and when this entry is /// not in any timer wheel lists. unsafe fn set_cached_when(&self, when: u64) { self.driver_state .0 .cached_when .store(when, Ordering::Relaxed); } /// Returns the true time...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
9706ca92a8deb69d6e29265f21424042fea966c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9706ca92a8deb69d6e29265f21424042fea966c5/tokio/src/time/driver/entry.rs
441
500
tokio-rs/tokio:tokio/src/time/driver/entry.rs:13
/// definitely _not_ registered. pub(super) fn might_be_registered(&self) -> bool { self.state.might_be_registered() } } /// Additional shared state between the driver and the timer which is cache /// padded. This contains the information that the driver thread accesses most /// frequently to minimize ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
9706ca92a8deb69d6e29265f21424042fea966c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9706ca92a8deb69d6e29265f21424042fea966c5/tokio/src/time/driver/entry.rs
481
540
tokio-rs/tokio:tokio/src/time/driver/entry.rs:14
pointers: StdUnsafeCell::new(linked_list::Pointers::new()), } } } unsafe impl Send for TimerShared {} unsafe impl Sync for TimerShared {} unsafe impl linked_list::Link for TimerShared { type Handle = TimerHandle; type Target = TimerShared; fn as_raw(handle: &Self::Handle) -> NonNull<Self::Ta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
9706ca92a8deb69d6e29265f21424042fea966c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9706ca92a8deb69d6e29265f21424042fea966c5/tokio/src/time/driver/entry.rs
521
580
tokio-rs/tokio:tokio/src/time/driver/entry.rs:15
fn inner(&self) -> &TimerShared { unsafe { &*self.inner.get() } } pub(crate) fn is_elapsed(&self) -> bool { !self.inner().state.might_be_registered() && self.initial_deadline.is_none() } /// Cancels and deregisters the timer. This operation is irreversible. pub(crate) fn cancel(sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
9706ca92a8deb69d6e29265f21424042fea966c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9706ca92a8deb69d6e29265f21424042fea966c5/tokio/src/time/driver/entry.rs
561
620
tokio-rs/tokio:tokio/src/time/driver/entry.rs:16
if self.inner().extend_expiration(tick).is_ok() { return; } unsafe { self.driver.reregister(tick, self.inner().into()); } } pub(crate) fn poll_elapsed( mut self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), super::Error>> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
9706ca92a8deb69d6e29265f21424042fea966c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9706ca92a8deb69d6e29265f21424042fea966c5/tokio/src/time/driver/entry.rs
601
660
tokio-rs/tokio:tokio/src/time/driver/entry.rs:17
/// 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_ref().set_expiration(tick); } /// Attempts to mark this entry as pending. If the expiration time is after /// `not_after`, however, returns an Err with th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
9706ca92a8deb69d6e29265f21424042fea966c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9706ca92a8deb69d6e29265f21424042fea966c5/tokio/src/time/driver/entry.rs
641
694
tokio-rs/tokio:tokio/src/time/driver/entry.rs:18
self.inner.as_ref().state.fire(completed_state) } } impl Drop for TimerEntry { fn drop(&mut self) { unsafe { Pin::new_unchecked(self) }.as_mut().cancel() } } #[cfg_attr(target_arch = "x86_64", repr(align(128)))] #[cfg_attr(not(target_arch = "x86_64"), repr(align(64)))] #[derive(Debug, Default)] st...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
9706ca92a8deb69d6e29265f21424042fea966c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9706ca92a8deb69d6e29265f21424042fea966c5/tokio/src/time/driver/entry.rs
681
694
tokio-rs/tokio:tokio/src/time/driver/entry.rs:11
state: StateCell, /// Data manipulated by the driver thread itself, only. driver_state: CachePadded<TimerSharedPadded>, _p: PhantomPinned, } impl TimerShared { pub(super) fn new() -> Self { Self { state: StateCell::default(), driver_state: CachePadded(TimerSharedPadded...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
ae67851f11b7cc1f577de8ce21767ce3e2c7aff9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/time/driver/entry.rs
401
460
tokio-rs/tokio:tokio/src/time/driver/entry.rs:12
pub(super) fn true_when(&self) -> u64 { self.state.when().expect("Timer already fired") } /// 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 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
ae67851f11b7cc1f577de8ce21767ce3e2c7aff9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/time/driver/entry.rs
441
500
tokio-rs/tokio:tokio/src/time/driver/entry.rs:13
/// 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 driver. true_when: AtomicU64, /// A link wit...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
ae67851f11b7cc1f577de8ce21767ce3e2c7aff9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/time/driver/entry.rs
481
540
tokio-rs/tokio:tokio/src/time/driver/entry.rs:14
type Target = TimerShared; fn as_raw(handle: &Self::Handle) -> NonNull<Self::Target> { handle.inner } unsafe fn from_raw(ptr: NonNull<Self::Target>) -> Self::Handle { TimerHandle { inner: ptr } } unsafe fn pointers( target: NonNull<Self::Target>, ) -> NonNull<linked_li...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
ae67851f11b7cc1f577de8ce21767ce3e2c7aff9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/time/driver/entry.rs
521
580
tokio-rs/tokio:tokio/src/time/driver/entry.rs:15
// 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. However, we've been doing a bunch of // relaxed (or...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
ae67851f11b7cc1f577de8ce21767ce3e2c7aff9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/time/driver/entry.rs
561
620
tokio-rs/tokio:tokio/src/time/driver/entry.rs:16
mut self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), super::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()) } } im...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
ae67851f11b7cc1f577de8ce21767ce3e2c7aff9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/time/driver/entry.rs
601
660
tokio-rs/tokio:tokio/src/time/driver/entry.rs:17
/// 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. /// After returning Ok, the entry must be added to the pending list. pub(super) unsafe fn mark_pending(&self, not_after: u64) -> Result<(), u64> { match...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
ae67851f11b7cc1f577de8ce21767ce3e2c7aff9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/time/driver/entry.rs
641
684
tokio-rs/tokio:tokio/src/time/driver/entry.rs:1
use crate::loom::sync::atomic::AtomicU64; use crate::sync::AtomicWaker; use crate::time::driver::{Handle, Inner}; use crate::time::{error::Error, Duration, Instant}; use std::cell::UnsafeCell; use std::ptr; use std::sync::atomic::Ordering::SeqCst; use std::sync::atomic::{AtomicBool, AtomicU8}; use std::sync::{Arc, Wea...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
0893841f31542b2b04c5050a8a4a3c45cf867e55
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/driver/entry.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/entry.rs:3
when: UnsafeCell<Option<u64>>, /// Next entry in the State's linked list. /// /// This is only accessed by the timer pub(crate) next_stack: UnsafeCell<Option<Arc<Entry>>>, /// Previous entry in the State's linked list. /// /// This is only accessed by the timer and is used to unlink a canc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
0893841f31542b2b04c5050a8a4a3c45cf867e55
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/driver/entry.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/entry.rs:4
} else { let when = inner.normalize_deadline(deadline); let state = if when <= inner.elapsed() { ELAPSED } else { when }; Entry::new2(deadline, duration, Arc::downgrade(&inner), state) }; let entry = Arc::new(en...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
0893841f31542b2b04c5050a8a4a3c45cf867e55
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/driver/entry.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/entry.rs:5
unsafe { *self.when.get() = when; } } /// Called by `Timer` to load the current value of `state` for processing pub(crate) fn load_state(&self) -> Option<u64> { let state = self.state.load(SeqCst); if is_elapsed(state) { None } else { Som...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
0893841f31542b2b04c5050a8a4a3c45cf867e55
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/driver/entry.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/entry.rs:6
} pub(crate) fn error(&self, error: Error) { // Record the precise nature of the error, if there isn't already an // error present. If we don't actually transition to the error state // below, that's fine, as the error details we set here will be ignored. self.error.compare_and_swap...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
0893841f31542b2b04c5050a8a4a3c45cf867e55
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/driver/entry.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/entry.rs:7
Some(inner) => inner, None => return, }; let _ = inner.queue(entry); } pub(crate) fn poll_elapsed(&self, cx: &mut task::Context<'_>) -> Poll<Result<(), Error>> { let mut curr = self.state.load(SeqCst); if is_elapsed(curr) { return Poll::Ready(if curr ==...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
0893841f31542b2b04c5050a8a4a3c45cf867e55
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/driver/entry.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/entry.rs:8
let deadline = entry.time_ref().deadline; let when = inner.normalize_deadline(deadline); let elapsed = inner.elapsed(); let next = if when <= elapsed { ELAPSED } else { when }; let mut curr = entry.state.load(SeqCst); loop { // In these two cases, there is no work ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
0893841f31542b2b04c5050a8a4a3c45cf867e55
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/driver/entry.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/entry.rs:9
fn new2(deadline: Instant, duration: Duration, inner: Weak<Inner>, state: u64) -> Self { Self { time: CachePadded(UnsafeCell::new(Time { deadline, duration })), inner, waker: AtomicWaker::new(), state: AtomicU64::new(state), queued: AtomicBool::new(fal...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
0893841f31542b2b04c5050a8a4a3c45cf867e55
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/time/driver/entry.rs
321
362
tokio-rs/tokio:tokio/src/time/driver/entry.rs:1
use crate::loom::sync::atomic::AtomicU64; use crate::sync::AtomicWaker; use crate::time::driver::{Handle, Inner}; use crate::time::{Duration, Error, Instant}; use std::cell::UnsafeCell; use std::ptr; use std::sync::atomic::Ordering::SeqCst; use std::sync::atomic::{AtomicBool, AtomicU8}; use std::sync::{Arc, Weak}; use...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
60d81bbe10faf344ea18438a1c5ecb9173e6ec52
github
async-runtime
https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/time/driver/entry.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/entry.rs:1
use crate::loom::sync::atomic::AtomicU64; use crate::sync::AtomicWaker; use crate::time::driver::{Handle, Inner}; use crate::time::{Duration, Error, Instant}; use std::cell::UnsafeCell; use std::ptr; use std::sync::atomic::Ordering::SeqCst; use std::sync::atomic::{AtomicBool, AtomicU8}; use std::sync::{Arc, Weak}; use...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
fcdf9345bf19e9a1e1664f01713f9eba54da27c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/driver/entry.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/entry.rs:3
when: UnsafeCell<Option<u64>>, /// Next entry in the State's linked list. /// /// This is only accessed by the timer pub(crate) next_stack: UnsafeCell<Option<Arc<Entry>>>, /// Previous entry in the State's linked list. /// /// This is only accessed by the timer and is used to unlink a canc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
fcdf9345bf19e9a1e1664f01713f9eba54da27c5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fcdf9345bf19e9a1e1664f01713f9eba54da27c5/tokio/src/time/driver/entry.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/entry.rs:3
when: UnsafeCell<Option<u64>>, /// Next entry in the State's linked list. /// /// This is only accessed by the timer pub(super) next_stack: UnsafeCell<Option<Arc<Entry>>>, /// Previous entry in the State's linked list. /// /// This is only accessed by the timer and is used to unlink a canc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/entry.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/entry.rs:4
} else { let when = inner.normalize_deadline(deadline); let state = if when <= inner.elapsed() { ELAPSED } else { when }; entry = Entry::new2(deadline, duration, Arc::downgrade(&inner), state); } let entry = Arc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/entry.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/entry.rs:5
/// Called by `Timer` to load the current value of `state` for processing pub(crate) fn load_state(&self) -> Option<u64> { let state = self.state.load(SeqCst); if is_elapsed(state) { None } else { Some(state) } } pub(crate) fn is_elapsed(&self) -> bo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/entry.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/entry.rs:6
// error present. If we don't actually transition to the error state // below, that's fine, as the error details we set here will be ignored. self.error.compare_and_swap(0, error.as_u8(), SeqCst); // Only transition to the error state if not currently elapsed let mut curr = self.state.l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/entry.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/entry.rs:7
let _ = inner.queue(entry); } pub(crate) fn poll_elapsed(&self, cx: &mut task::Context<'_>) -> Poll<Result<(), Error>> { let mut curr = self.state.load(SeqCst); if is_elapsed(curr) { return Poll::Ready(if curr == ERROR { Err(Error::from_u8(self.error.load(SeqCst))) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/entry.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/entry.rs:8
let next = if when <= elapsed { ELAPSED } else { when }; let mut curr = entry.state.load(SeqCst); loop { // In these two cases, there is no work to do when resetting the // timer. If the `Entry` is in an error state, then it cannot be // used anymore. If resetting t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/entry.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/entry.rs:9
waker: AtomicWaker::new(), state: AtomicU64::new(state), queued: AtomicBool::new(false), error: AtomicU8::new(0), next_atomic: UnsafeCell::new(ptr::null_mut()), when: UnsafeCell::new(None), next_stack: UnsafeCell::new(None), prev_stack:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
d1744bf260384838e00311230faf7787a97f477b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1744bf260384838e00311230faf7787a97f477b/tokio/src/time/driver/entry.rs
321
358
tokio-rs/tokio:tokio/src/time/driver/entry.rs:1
use crate::loom::sync::atomic::AtomicU64; use crate::sync::AtomicWaker; use crate::time::driver::{Handle, Inner}; use crate::time::{Duration, Error, Instant}; use std::cell::UnsafeCell; use std::ptr; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering::SeqCst; use std::sync::{Arc, Weak}; use std::task::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
32f46d7b883e1447833630464f168bb160fb51c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32f46d7b883e1447833630464f168bb160fb51c9/tokio/src/time/driver/entry.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/entry.rs:2
/// * Whether or not the entry transitioned to the error state. /// /// When an `Entry` is created, `state` is initialized to the instant at /// which the entry must be fired. When a timer is reset to a different /// instant, this value is changed. state: AtomicU64, /// Task to notify once the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
32f46d7b883e1447833630464f168bb160fb51c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32f46d7b883e1447833630464f168bb160fb51c9/tokio/src/time/driver/entry.rs
41
100
tokio-rs/tokio:tokio/src/time/driver/entry.rs:3
pub(super) next_stack: UnsafeCell<Option<Arc<Entry>>>, /// Previous entry in the State's linked list. /// /// This is only accessed by the timer and is used to unlink a canceled /// entry. /// /// This is a weak reference. pub(super) prev_stack: UnsafeCell<*const Entry>, } /// Stores the i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
32f46d7b883e1447833630464f168bb160fb51c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32f46d7b883e1447833630464f168bb160fb51c9/tokio/src/time/driver/entry.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/entry.rs:4
}; entry = Entry::new2(deadline, duration, Arc::downgrade(&inner), state); } let entry = Arc::new(entry); if inner.queue(&entry).is_err() { entry.error(); } entry } /// Only called by `Registration` pub(crate) fn time_ref(&self) -> &Time { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
32f46d7b883e1447833630464f168bb160fb51c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32f46d7b883e1447833630464f168bb160fb51c9/tokio/src/time/driver/entry.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/entry.rs:5
None } else { Some(state) } } pub(crate) fn is_elapsed(&self) -> bool { let state = self.state.load(SeqCst); is_elapsed(state) } pub(crate) fn fire(&self, when: u64) { let mut curr = self.state.load(SeqCst); loop { if is_elapsed(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
32f46d7b883e1447833630464f168bb160fb51c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32f46d7b883e1447833630464f168bb160fb51c9/tokio/src/time/driver/entry.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/entry.rs:6
let next = ERROR; let actual = self.state.compare_and_swap(curr, next, SeqCst); if curr == actual { break; } curr = actual; } self.waker.wake(); } pub(crate) fn cancel(entry: &Arc<Entry>) { let state = entry.state.fetch...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
32f46d7b883e1447833630464f168bb160fb51c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32f46d7b883e1447833630464f168bb160fb51c9/tokio/src/time/driver/entry.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/entry.rs:7
}); } self.waker.register_by_ref(cx.waker()); curr = self.state.load(SeqCst); if is_elapsed(curr) { return Poll::Ready(if curr == ERROR { Err(Error::shutdown()) } else { Ok(()) }); } Poll::Pending ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
32f46d7b883e1447833630464f168bb160fb51c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32f46d7b883e1447833630464f168bb160fb51c9/tokio/src/time/driver/entry.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/entry.rs:8
} let actual = entry.state.compare_and_swap(curr, next, SeqCst); if curr == actual { break; } curr = actual; } // If the state has transitioned to 'elapsed' then wake the task as // this entry is ready to be polled. if !...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
32f46d7b883e1447833630464f168bb160fb51c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32f46d7b883e1447833630464f168bb160fb51c9/tokio/src/time/driver/entry.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/entry.rs:9
self.inner.upgrade() } } fn is_elapsed(state: u64) -> bool { state & ELAPSED == ELAPSED } impl Drop for Entry { fn drop(&mut self) { let inner = match self.upgrade_inner() { Some(inner) => inner, None => return, }; inner.decrement(); } } unsafe impl Se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
32f46d7b883e1447833630464f168bb160fb51c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32f46d7b883e1447833630464f168bb160fb51c9/tokio/src/time/driver/entry.rs
321
346
tokio-rs/tokio:tokio/src/time/driver/entry.rs:1
use crate::loom::sync::atomic::AtomicU64; use crate::sync::AtomicWaker; use crate::time::driver::{Handle, Inner}; use crate::time::{Duration, Error, Instant}; use std::cell::UnsafeCell; use std::ptr; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering::SeqCst; use std::sync::{Arc, Weak}; use std::task::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
947045b9445f15fb9314ba0892efa2251076ae73
github
async-runtime
https://github.com/tokio-rs/tokio/blob/947045b9445f15fb9314ba0892efa2251076ae73/tokio/src/time/driver/entry.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/entry.rs:2
/// /// When an `Entry` is created, `state` is initialized to the instant at /// which the entry must be fired. When a timer is reset to a different /// instant, this value is changed. state: AtomicU64, /// Task to notify once the deadline is reached. waker: AtomicWaker, /// True when the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
947045b9445f15fb9314ba0892efa2251076ae73
github
async-runtime
https://github.com/tokio-rs/tokio/blob/947045b9445f15fb9314ba0892efa2251076ae73/tokio/src/time/driver/entry.rs
41
100
tokio-rs/tokio:tokio/src/time/driver/entry.rs:3
/// Previous entry in the State's linked list. /// /// This is only accessed by the timer and is used to unlink a canceled /// entry. /// /// This is a weak reference. pub(super) prev_stack: UnsafeCell<*const Entry>, } /// Stores the info for `Delay`. #[derive(Debug)] pub(crate) struct Time { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
947045b9445f15fb9314ba0892efa2251076ae73
github
async-runtime
https://github.com/tokio-rs/tokio/blob/947045b9445f15fb9314ba0892efa2251076ae73/tokio/src/time/driver/entry.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/entry.rs:4
entry = Entry::new2(deadline, duration, Arc::downgrade(&inner), state); } let entry = Arc::new(entry); if inner.queue(&entry).is_err() { entry.error(); } entry } /// Only called by `Registration` pub(crate) fn time_ref(&self) -> &Time { unsafe {...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
947045b9445f15fb9314ba0892efa2251076ae73
github
async-runtime
https://github.com/tokio-rs/tokio/blob/947045b9445f15fb9314ba0892efa2251076ae73/tokio/src/time/driver/entry.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/entry.rs:5
} else { Some(state) } } pub(crate) fn is_elapsed(&self) -> bool { let state = self.state.load(SeqCst); is_elapsed(state) } pub(crate) fn fire(&self, when: u64) { let mut curr = self.state.load(SeqCst); loop { if is_elapsed(curr) || curr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
947045b9445f15fb9314ba0892efa2251076ae73
github
async-runtime
https://github.com/tokio-rs/tokio/blob/947045b9445f15fb9314ba0892efa2251076ae73/tokio/src/time/driver/entry.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/entry.rs:6
let next = ERROR; let actual = self.state.compare_and_swap(curr, next, SeqCst); if curr == actual { break; } curr = actual; } self.waker.wake(); } pub(crate) fn cancel(entry: &Arc<Entry>) { let state = entry.state.fetch...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
947045b9445f15fb9314ba0892efa2251076ae73
github
async-runtime
https://github.com/tokio-rs/tokio/blob/947045b9445f15fb9314ba0892efa2251076ae73/tokio/src/time/driver/entry.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/entry.rs:7
} self.waker.register_by_ref(cx.waker()); curr = self.state.load(SeqCst); if is_elapsed(curr) { return Poll::Ready(if curr == ERROR { Err(Error::shutdown()) } else { Ok(()) }); } Poll::Pending } /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
947045b9445f15fb9314ba0892efa2251076ae73
github
async-runtime
https://github.com/tokio-rs/tokio/blob/947045b9445f15fb9314ba0892efa2251076ae73/tokio/src/time/driver/entry.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/entry.rs:8
let actual = entry.state.compare_and_swap(curr, next, SeqCst); if curr == actual { break; } curr = actual; } // If the state has transitioned to 'elapsed' then wake the task as // this entry is ready to be polled. if !is_elapsed(curr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
947045b9445f15fb9314ba0892efa2251076ae73
github
async-runtime
https://github.com/tokio-rs/tokio/blob/947045b9445f15fb9314ba0892efa2251076ae73/tokio/src/time/driver/entry.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/entry.rs:9
} } fn is_elapsed(state: u64) -> bool { state & ELAPSED == ELAPSED } impl Drop for Entry { fn drop(&mut self) { let inner = match self.upgrade_inner() { Some(inner) => inner, None => return, }; inner.decrement(); } } unsafe impl Send for Entry {} unsafe im...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
947045b9445f15fb9314ba0892efa2251076ae73
github
async-runtime
https://github.com/tokio-rs/tokio/blob/947045b9445f15fb9314ba0892efa2251076ae73/tokio/src/time/driver/entry.rs
321
345
tokio-rs/tokio:tokio/src/time/driver/entry.rs:7
} self.waker.register_by_ref(cx.waker()); curr = self.state.load(SeqCst); if is_elapsed(curr) { return Poll::Ready(if curr == ERROR { Err(Error::shutdown()) } else { Ok(()) }); } Poll::Pending } /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
71c47fabf4a8a450c3b41d58de304a6a49fb4061
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71c47fabf4a8a450c3b41d58de304a6a49fb4061/tokio/src/time/driver/entry.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/entry.rs:8
let next; if when <= elapsed { next = ELAPSED; notify = !is_elapsed(curr); } else { next = when; notify = true; } let actual = entry.state.compare_and_swap(curr, next, SeqCst); if curr == actua...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
71c47fabf4a8a450c3b41d58de304a6a49fb4061
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71c47fabf4a8a450c3b41d58de304a6a49fb4061/tokio/src/time/driver/entry.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/entry.rs:4
entry = Entry::new2(deadline, duration, Arc::downgrade(&inner), state); } let entry = Arc::new(entry); if inner.queue(&entry).is_err() { entry.error(); } entry } /// Only called by `Registration` pub(crate) fn time_ref(&self) -> &Time { unsafe {...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
f0006006ed9938115011c42f26cff16842eb534f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f0006006ed9938115011c42f26cff16842eb534f/tokio/src/time/driver/entry.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/entry.rs:3
/// Previous entry in the State's linked list. /// /// This is only accessed by the timer and is used to unlink a canceled /// entry. /// /// This is a weak reference. pub(super) prev_stack: UnsafeCell<*const Entry>, } /// Stores the info for `Delay`. #[derive(Debug)] pub(crate) struct Time { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
dbcd1f9a0964c64d5aa335649eabea281ac59574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dbcd1f9a0964c64d5aa335649eabea281ac59574/tokio/src/time/driver/entry.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/entry.rs:1
use crate::loom::sync::atomic::AtomicU64; use crate::sync::AtomicWaker; use crate::time::driver::{HandlePriv, Inner}; use crate::time::{Duration, Error, Instant}; use std::cell::UnsafeCell; use std::ptr; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering::SeqCst; use std::sync::{Arc, Weak}; use std::ta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
3e643c7b81736a4c2b11387a6f71aba99450270b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e643c7b81736a4c2b11387a6f71aba99450270b/tokio/src/time/driver/entry.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/entry.rs:3
/// Previous entry in the State's linked list. /// /// This is only accessed by the timer and is used to unlink a canceled /// entry. /// /// This is a weak reference. pub(super) prev_stack: UnsafeCell<*const Entry>, } /// Stores the info for `Delay`. #[derive(Debug)] pub(crate) struct Time { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
3e643c7b81736a4c2b11387a6f71aba99450270b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e643c7b81736a4c2b11387a6f71aba99450270b/tokio/src/time/driver/entry.rs
81
140
tokio-rs/tokio:tokio/src/time/driver/entry.rs:4
} else { when }; let entry = Arc::new(Entry { time: CachePadded(UnsafeCell::new(Time { deadline, duration })), inner: handle_priv.into_inner(), waker: AtomicWaker::new(), state: AtomicU64::new(state), queued: AtomicBool::new(false)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
3e643c7b81736a4c2b11387a6f71aba99450270b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e643c7b81736a4c2b11387a6f71aba99450270b/tokio/src/time/driver/entry.rs
121
180
tokio-rs/tokio:tokio/src/time/driver/entry.rs:5
pub(crate) fn set_when_internal(&self, when: Option<u64>) { unsafe { (*self.when.get()) = when; } } /// Called by `Timer` to load the current value of `state` for processing pub(crate) fn load_state(&self) -> Option<u64> { let state = self.state.load(SeqCst); if...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
3e643c7b81736a4c2b11387a6f71aba99450270b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e643c7b81736a4c2b11387a6f71aba99450270b/tokio/src/time/driver/entry.rs
161
220
tokio-rs/tokio:tokio/src/time/driver/entry.rs:6
self.waker.wake(); } pub(crate) fn error(&self) { // Only transition to the error state if not currently elapsed let mut curr = self.state.load(SeqCst); loop { if is_elapsed(curr) { return; } let next = ERROR; let actual...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
3e643c7b81736a4c2b11387a6f71aba99450270b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e643c7b81736a4c2b11387a6f71aba99450270b/tokio/src/time/driver/entry.rs
201
260
tokio-rs/tokio:tokio/src/time/driver/entry.rs:7
let _ = inner.queue(entry); } pub(crate) fn poll_elapsed(&self, cx: &mut task::Context<'_>) -> Poll<Result<(), Error>> { let mut curr = self.state.load(SeqCst); if is_elapsed(curr) { return Poll::Ready(if curr == ERROR { Err(Error::shutdown()) } else { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
3e643c7b81736a4c2b11387a6f71aba99450270b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e643c7b81736a4c2b11387a6f71aba99450270b/tokio/src/time/driver/entry.rs
241
300
tokio-rs/tokio:tokio/src/time/driver/entry.rs:8
let mut curr = entry.state.load(SeqCst); let mut notify; loop { // In these two cases, there is no work to do when resetting the // timer. If the `Entry` is in an error state, then it cannot be // used anymore. If resetting the entry to the current value, then ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
3e643c7b81736a4c2b11387a6f71aba99450270b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e643c7b81736a4c2b11387a6f71aba99450270b/tokio/src/time/driver/entry.rs
281
340
tokio-rs/tokio:tokio/src/time/driver/entry.rs:9
fn is_elapsed(state: u64) -> bool { state & ELAPSED == ELAPSED } impl Drop for Entry { fn drop(&mut self) { let inner = match self.upgrade_inner() { Some(inner) => inner, None => return, }; inner.decrement(); } } unsafe impl Send for Entry {} unsafe impl Sy...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/entry.rs
MIT
3e643c7b81736a4c2b11387a6f71aba99450270b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e643c7b81736a4c2b11387a6f71aba99450270b/tokio/src/time/driver/entry.rs
321
343
tokio-rs/tokio:tokio/src/time/driver/handle.rs:1
use crate::loom::sync::Arc; use crate::time::driver::ClockTime; use std::fmt; /// Handle to time driver instance. #[derive(Clone)] pub(crate) struct Handle { time_source: ClockTime, inner: Arc<super::Inner>, } impl Handle { /// Creates a new timer `Handle` from a shared `Inner` timer state. pub(super)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/handle.rs
MIT
3cc616877d7f0122b4547f4ccd6a6c13b61b2036
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3cc616877d7f0122b4547f4ccd6a6c13b61b2036/tokio/src/time/driver/handle.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/handle.rs:1
use crate::loom::sync::Arc; use crate::time::driver::ClockTime; use std::fmt; /// Handle to time driver instance. #[derive(Clone)] pub(crate) struct Handle { time_source: ClockTime, inner: Arc<super::Inner>, } impl Handle { /// Creates a new timer `Handle` from a shared `Inner` timer state. pub(super)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/handle.rs
MIT
2c0e5c97049cbd527754477709839fb1f52ed282
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2c0e5c97049cbd527754477709839fb1f52ed282/tokio/src/time/driver/handle.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/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/time/driver/handle.rs
MIT
2c0e5c97049cbd527754477709839fb1f52ed282
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2c0e5c97049cbd527754477709839fb1f52ed282/tokio/src/time/driver/handle.rs
41
94
tokio-rs/tokio:tokio/src/time/driver/handle.rs:3
/// /// [`Builder::enable_time`]: crate::runtime::Builder::enable_time /// [`Builder::enable_all`]: crate::runtime::Builder::enable_all pub(crate) fn current() -> Self { panic!("{}", crate::util::error::CONTEXT_MISSING_ERROR) } } } impl fmt::Debug for Handle { fn fmt...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/handle.rs
MIT
2c0e5c97049cbd527754477709839fb1f52ed282
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2c0e5c97049cbd527754477709839fb1f52ed282/tokio/src/time/driver/handle.rs
81
94
tokio-rs/tokio:tokio/src/time/driver/handle.rs:1
use crate::loom::sync::Arc; use crate::time::driver::ClockTime; use std::fmt; /// Handle to time driver instance. #[derive(Clone)] pub(crate) struct Handle { time_source: ClockTime, inner: Arc<super::Inner>, } impl Handle { /// Creates a new timer `Handle` from a shared `Inner` timer state. pub(super)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/handle.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/time/driver/handle.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/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/time/driver/handle.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/time/driver/handle.rs
41
88
tokio-rs/tokio:tokio/src/time/driver/handle.rs:1
use crate::loom::sync::Arc; use crate::time::driver::ClockTime; use std::fmt; /// Handle to time driver instance. #[derive(Clone)] pub(crate) struct Handle { time_source: ClockTime, inner: Arc<super::Inner>, } impl Handle { /// Creates a new timer `Handle` from a shared `Inner` timer state. pub(super)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/handle.rs
MIT
c4b6b130f33532e891e1021381b203f1bbced086
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c4b6b130f33532e891e1021381b203f1bbced086/tokio/src/time/driver/handle.rs
1
60
tokio-rs/tokio:tokio/src/time/driver/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/time/driver/handle.rs
MIT
9a3603fa75ff854e007d372061edf47cf8d02690
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9a3603fa75ff854e007d372061edf47cf8d02690/tokio/src/time/driver/handle.rs
41
88
tokio-rs/tokio:tokio/src/time/driver/handle.rs:1
use crate::loom::sync::Arc; use crate::time::driver::ClockTime; use std::fmt; /// Handle to time driver instance. #[derive(Clone)] pub(crate) struct Handle { time_source: ClockTime, inner: Arc<super::Inner>, } impl Handle { /// Creates a new timer `Handle` from a shared `Inner` timer state. pub(super)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/time/driver/handle.rs
MIT
c39d9867bb989396bb02e74d87f2805969f43f03
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c39d9867bb989396bb02e74d87f2805969f43f03/tokio/src/time/driver/handle.rs
1
60