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/stats/stats.rs:4
let worker = &to.workers[self.my_index]; worker.park_count.store(self.park_count, Relaxed); worker.steal_count.store(self.steal_count, Relaxed); worker.poll_count.store(self.poll_count, Relaxed); let mut min = u64::MAX; let mut max = 0; let last = self.busy_duration[sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/stats/stats.rs
MIT
f45320a9c0b05c65b2d5e24ecb33edfd81ac45f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f45320a9c0b05c65b2d5e24ecb33edfd81ac45f9/tokio/src/runtime/stats/stats.rs
121
175
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:5
} pub(crate) fn returned_from_park(&mut self) { self.last_resume_time = Instant::now(); } #[cfg(feature = "rt-multi-thread")] pub(crate) fn incr_steal_count(&mut self, by: u16) { self.steal_count += u64::from(by); } pub(crate) fn incr_poll_count(&mut self) { self.poll_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/stats/stats.rs
MIT
f45320a9c0b05c65b2d5e24ecb33edfd81ac45f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f45320a9c0b05c65b2d5e24ecb33edfd81ac45f9/tokio/src/runtime/stats/stats.rs
161
175
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:1
//! This file contains the types necessary to collect various types of stats. use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed}; /// This type contains methods to retrieve stats from a Tokio runtime. #[derive(Debug)] pub struct RuntimeStats { workers: Box<[WorkerStats]>, } /// This type contains metho...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/stats/stats.rs
MIT
98578a6f4a494e709f00018b1cd5b0e3dd9a0f72
github
async-runtime
https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/stats/stats.rs
1
60
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:2
impl WorkerStats { /// Returns the total number of times this worker thread has parked. pub fn park_count(&self) -> u64 { self.park_count.load(Relaxed) } /// Returns the number of tasks this worker has stolen from other worker /// threads. pub fn steal_count(&self) -> u64 { self...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/stats/stats.rs
MIT
98578a6f4a494e709f00018b1cd5b0e3dd9a0f72
github
async-runtime
https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/stats/stats.rs
41
97
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:3
} pub(crate) fn about_to_park(&mut self) { self.park_count += 1; } pub(crate) fn returned_from_park(&mut self) {} #[cfg(feature = "rt-multi-thread")] pub(crate) fn incr_steal_count(&mut self, by: u16) { self.steal_count += u64::from(by); } pub(crate) fn incr_poll_count(&m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/stats/stats.rs
MIT
98578a6f4a494e709f00018b1cd5b0e3dd9a0f72
github
async-runtime
https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/stats/stats.rs
81
97
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:1
use crate::runtime::task::{Header, RawTask}; use std::fmt; use std::panic::{RefUnwindSafe, UnwindSafe}; /// An owned permission to abort a spawned task, without awaiting its completion. /// /// Unlike a [`JoinHandle`], an `AbortHandle` does *not* represent the /// permission to await the task's completion, only to ter...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/abort.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:2
/// Be aware that tasks spawned using [`spawn_blocking`] cannot be aborted /// because they are not async. If you call `abort` on a `spawn_blocking` /// task, then this *will not have any effect*, and the task will continue /// running normally. The exception is if the task has not started running /// y...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/abort.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:3
impl UnwindSafe for AbortHandle {} impl RefUnwindSafe for AbortHandle {} impl fmt::Debug for AbortHandle { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { // Safety: The header pointer is valid. let id_ptr = unsafe { Header::get_id_ptr(self.raw.header_ptr()) }; let id = unsafe ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/abort.rs
81
105
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:2
/// Be aware that tasks spawned using [`spawn_blocking`] cannot be aborted /// because they are not async. If you call `abort` on a `spawn_blocking` /// task, then this *will not have any effect*, and the task will continue /// running normally. The exception is if the task has not started running /// y...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
126ce89bb40f4d3ea2a174372694276e1b135985
github
async-runtime
https://github.com/tokio-rs/tokio/blob/126ce89bb40f4d3ea2a174372694276e1b135985/tokio/src/runtime/task/abort.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:3
unsafe { Header::get_id(self.raw.header_ptr()) } } } unsafe impl Send for AbortHandle {} unsafe impl Sync for AbortHandle {} impl UnwindSafe for AbortHandle {} impl RefUnwindSafe for AbortHandle {} impl fmt::Debug for AbortHandle { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { // Safet...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
126ce89bb40f4d3ea2a174372694276e1b135985
github
async-runtime
https://github.com/tokio-rs/tokio/blob/126ce89bb40f4d3ea2a174372694276e1b135985/tokio/src/runtime/task/abort.rs
81
112
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:3
unsafe { Header::get_id(self.raw.header_ptr()) } } } unsafe impl Send for AbortHandle {} unsafe impl Sync for AbortHandle {} impl UnwindSafe for AbortHandle {} impl RefUnwindSafe for AbortHandle {} impl fmt::Debug for AbortHandle { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { // Safet...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
a02407171a3f1aeb86e7406bcac9dfb415278308
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a02407171a3f1aeb86e7406bcac9dfb415278308/tokio/src/runtime/task/abort.rs
81
104
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:1
use crate::runtime::task::{Header, RawTask}; use std::fmt; use std::panic::{RefUnwindSafe, UnwindSafe}; /// An owned permission to abort a spawned task, without awaiting its completion. /// /// Unlike a [`JoinHandle`], an `AbortHandle` does *not* represent the /// permission to await the task's completion, only to ter...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
3468b4b72f4e5a5ae89b1ff059ccde576dceb459
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3468b4b72f4e5a5ae89b1ff059ccde576dceb459/tokio/src/runtime/task/abort.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:2
} /// Checks if the task associated with this `AbortHandle` has finished. /// /// Please note that this method can return `false` even if `abort` has been /// called on the task. This is because the cancellation process may take /// some time, and this method does not return `true` until it has ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
3468b4b72f4e5a5ae89b1ff059ccde576dceb459
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3468b4b72f4e5a5ae89b1ff059ccde576dceb459/tokio/src/runtime/task/abort.rs
41
90
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:3
let id = unsafe { id_ptr.as_ref() }; fmt.debug_struct("AbortHandle").field("id", id).finish() } } impl Drop for AbortHandle { fn drop(&mut self) { self.raw.drop_abort_handle(); } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
3468b4b72f4e5a5ae89b1ff059ccde576dceb459
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3468b4b72f4e5a5ae89b1ff059ccde576dceb459/tokio/src/runtime/task/abort.rs
81
90
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:1
use crate::runtime::task::{Header, RawTask}; use std::fmt; use std::panic::{RefUnwindSafe, UnwindSafe}; /// An owned permission to abort a spawned task, without awaiting its completion. /// /// Unlike a [`JoinHandle`], an `AbortHandle` does *not* represent the /// permission to await the task's completion, only to ter...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/abort.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:2
/// /// Please note that this method can return `false` even if `abort` has been /// called on the task. This is because the cancellation process may take /// some time, and this method does not return `true` until it has /// completed. pub fn is_finished(&self) -> bool { let state = self.ra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/abort.rs
41
87
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:1
use crate::runtime::task::{Id, RawTask}; use std::fmt; use std::panic::{RefUnwindSafe, UnwindSafe}; /// An owned permission to abort a spawned task, without awaiting its completion. /// /// Unlike a [`JoinHandle`], an `AbortHandle` does *not* represent the /// permission to await the task's completion, only to termina...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/abort.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:2
} /// Checks if the task associated with this `AbortHandle` has finished. /// /// Please note that this method can return `false` even if `abort` has been /// called on the task. This is because the cancellation process may take /// some time, and this method does not return `true` until it has ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/abort.rs
41
94
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:3
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("AbortHandle") .field("id", &self.id) .finish() } } impl Drop for AbortHandle { fn drop(&mut self) { if let Some(raw) = self.raw.take() { raw.drop_abort_handle(); } } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/abort.rs
81
94
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:2
} /// Checks if the task associated with this `AbortHandle` has finished. /// /// Please note that this method can return `false` even if `abort` has been /// called on the task. This is because the cancellation process may take /// some time, and this method does not return `true` until it has ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe/tokio/src/runtime/task/abort.rs
41
94
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:1
use crate::runtime::task::{Id, RawTask}; use std::fmt; use std::panic::{RefUnwindSafe, UnwindSafe}; /// An owned permission to abort a spawned task, without awaiting its completion. /// /// Unlike a [`JoinHandle`], an `AbortHandle` does *not* represent the /// permission to await the task's completion, only to termina...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b/tokio/src/runtime/task/abort.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:2
/// [cancelled]: method@super::error::JoinError::is_cancelled /// [`JoinHandle::abort`]: method@super::JoinHandle::abort // the `AbortHandle` type is only publicly exposed when `tokio_unstable` is // enabled, but it is still defined for testing purposes. #[cfg_attr(not(tokio_unstable), allow(unreachable...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b/tokio/src/runtime/task/abort.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:3
} } unsafe impl Send for AbortHandle {} unsafe impl Sync for AbortHandle {} impl UnwindSafe for AbortHandle {} impl RefUnwindSafe for AbortHandle {} impl fmt::Debug for AbortHandle { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("AbortHandle") .field("id", &sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b/tokio/src/runtime/task/abort.rs
81
104
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:1
use crate::runtime::task::{Id, RawTask}; use std::fmt; use std::panic::{RefUnwindSafe, UnwindSafe}; /// An owned permission to abort a spawned task, without awaiting its completion. /// /// Unlike a [`JoinHandle`], an `AbortHandle` does *not* represent the /// permission to await the task's completion, only to termina...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
d456706528edf387a70223a2966338b2c3cace53
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d456706528edf387a70223a2966338b2c3cace53/tokio/src/runtime/task/abort.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:2
/// [cancelled]: method@super::error::JoinError::is_cancelled /// [`JoinHandle::abort`]: method@super::JoinHandle::abort // the `AbortHandle` type is only publicly exposed when `tokio_unstable` is // enabled, but it is still defined for testing purposes. #[cfg_attr(not(tokio_unstable), allow(unreachable...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
d456706528edf387a70223a2966338b2c3cace53
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d456706528edf387a70223a2966338b2c3cace53/tokio/src/runtime/task/abort.rs
41
88
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:1
use crate::runtime::task::{Id, RawTask}; use std::fmt; use std::panic::{RefUnwindSafe, UnwindSafe}; /// An owned permission to abort a spawned task, without awaiting its completion. /// /// Unlike a [`JoinHandle`], an `AbortHandle` does *not* represent the /// permission to await the task's completion, only to termina...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/abort.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:2
/// [cancelled]: method@super::error::JoinError::is_cancelled /// [`JoinHandle::abort`]: method@super::JoinHandle::abort // the `AbortHandle` type is only publicly exposed when `tokio_unstable` is // enabled, but it is still defined for testing purposes. #[cfg_attr(not(tokio_unstable), allow(unreachable...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/abort.rs
41
88
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:1
use crate::runtime::task::RawTask; use std::fmt; use std::panic::{RefUnwindSafe, UnwindSafe}; /// An owned permission to abort a spawned task, without awaiting its completion. /// /// Unlike a [`JoinHandle`], an `AbortHandle` does *not* represent the /// permission to await the task's completion, only to terminate it....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
ac69d37302b6639343af3ed3e34707fac29b8581
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ac69d37302b6639343af3ed3e34707fac29b8581/tokio/src/runtime/task/abort.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:2
/// [`JoinHandle::abort`]: method@super::JoinHandle::abort // the `AbortHandle` type is only publicly exposed when `tokio_unstable` is // enabled, but it is still defined for testing purposes. #[cfg_attr(not(tokio_unstable), allow(unreachable_pub))] pub fn abort(self) { if let Some(raw) = self.r...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
ac69d37302b6639343af3ed3e34707fac29b8581
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ac69d37302b6639343af3ed3e34707fac29b8581/tokio/src/runtime/task/abort.rs
41
70
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:1
use crate::runtime::task::RawTask; use std::fmt; use std::panic::{RefUnwindSafe, UnwindSafe}; /// An owned permission to abort a spawned task, without awaiting its completion. /// /// Unlike a [`JoinHandle`], an `AbortHandle` does *not* represent the /// permission to await the task's completion, only to terminate it....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/abort.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/abort.rs:2
// the `AbortHandle` type is only publicly exposed when `tokio_unstable` is // enabled, but it is still defined for testing purposes. #[cfg_attr(not(tokio_unstable), allow(unreachable_pub))] pub fn abort(self) { if let Some(raw) = self.raw { raw.remote_abort(); } } } unsafe ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/abort.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/abort.rs
41
69
tokio-rs/tokio:tokio/src/runtime/task/atomic_notified.rs:1
use crate::loom::sync::atomic::AtomicPtr; use crate::runtime::task::{Header, Notified, RawTask}; use std::marker::PhantomData; use std::ptr; use std::ptr::NonNull; use std::sync::atomic::Ordering::SeqCst; /// An atomic cell which can contain a pointer to a [`Notified`] task. /// /// This is similar to the `crate::uti...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/atomic_notified.rs
MIT
eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/atomic_notified.rs
1
58
tokio-rs/tokio:tokio/src/runtime/task/core.rs:1
//! Core task module. //! //! # Safety //! //! The functions in this module are private to the `task` module. All of them //! should be considered `unsafe` to use, but are not marked as such since it //! would be too noisy. //! //! Make sure to consult the relevant safety section of each function before //! use. // It...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/core.rs:2
/// Any changes to the layout of this struct _must_ also be reflected in the /// `const` fns in raw.rs. /// // # This struct should be cache padded to avoid false sharing. The cache padding rules are copied // from crossbeam-utils/src/cache_padded.rs // // Starting from Intel's Sandy Bridge, spatial prefetcher is now p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
any( target_arch = "arm", target_arch = "mips", target_arch = "mips64", target_arch = "sparc", target_arch = "hexagon", ), repr(align(32)) )] // m68k has 16-byte cache line size. // // Sources: // - https://github.com/torvalds/linux/blob/3516bd729358a2a9b090c1905bd2a3fa92...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
target_arch = "s390x", )), repr(align(64)) )] #[repr(C)] pub(super) struct Cell<T: Future, S> { /// Hot task state data pub(super) header: Header, /// Either the future or output, depending on the execution stage. pub(super) core: Core<T, S>, /// Cold data pub(super) trailer: Trailer, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
/// Either the future or the output. pub(super) stage: CoreStage<T>, } /// Crate public as this is also needed by the pool. #[repr(C)] pub(crate) struct Header { /// Task state. pub(super) state: State, /// Pointer to next task, used with the injection queue. pub(super) queue_next: UnsafeCell<Opti...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
pub(super) struct Trailer { /// Pointers for the linked list in the `OwnedTasks` that owns this task. pub(super) owned: linked_list::Pointers<Header>, /// Consumer task waiting on completion of this task. pub(super) waker: UnsafeCell<Option<Waker>>, /// Optional hooks needed in the harness. #[cf...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
#[cfg(all(tokio_unstable, feature = "tracing"))] tracing_id: Option<tracing::Id>, ) -> Header { Header { state, queue_next: UnsafeCell::new(None), vtable, owner_id: UnsafeCell::new(None), #[cfg(all(tokio_unstable, featur...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:8
scheduler: &S, task_id: &Id, #[cfg(tokio_unstable)] spawn_location: &&'static Location<'static>, ) { let trailer_addr = trailer as *const Trailer as usize; let trailer_ptr = unsafe { Header::get_trailer(NonNull::from(header)) }; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/core.rs:9
impl<T: Future> CoreStage<T> { pub(super) fn with_mut<R>(&self, f: impl FnOnce(*mut Stage<T>) -> R) -> R { self.stage.with_mut(f) } } /// Set and clear the task id in the context when the future is executed or /// dropped, or when the output produced by the future is dropped. pub(crate) struct TaskIdGu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/core.rs:10
/// heap. pub(super) fn poll(&self, mut cx: Context<'_>) -> Poll<T::Output> { let res = { self.stage.stage.with_mut(|ptr| { // Safety: The caller ensures mutual exclusion to the field. let future = match unsafe { &mut *ptr } { Stage::Running(fu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/core.rs:11
/// /// The caller must ensure it is safe to mutate the `stage` field. pub(super) fn store_output(&self, output: super::Result<T::Output>) { // Safety: the caller ensures mutual exclusion to the field. unsafe { self.set_stage(Stage::Finished(output)); } } /// Takes t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/core.rs:12
pub(super) unsafe fn set_owner_id(&self, owner: NonZeroU64) { self.owner_id.with_mut(|ptr| *ptr = Some(owner)); } pub(super) fn get_owner_id(&self) -> Option<NonZeroU64> { // safety: If there are concurrent writes, then that write has violated // the safety requirements on `set_owner_id...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/core.rs:13
pub(super) unsafe fn get_id_ptr(me: NonNull<Header>) -> NonNull<Id> { let offset = me.as_ref().vtable.id_offset; let id = me.as_ptr().cast::<u8>().add(offset).cast::<Id>(); NonNull::new_unchecked(id) } /// Gets the id of the task containing this `Header`. /// /// # Safety //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
481
540
tokio-rs/tokio:tokio/src/runtime/task/core.rs:14
/// The provided raw pointer must point at the header of a task. #[cfg(tokio_unstable)] pub(super) unsafe fn get_spawn_location(me: NonNull<Header>) -> &'static Location<'static> { let ptr = Header::get_spawn_location_ptr(me).as_ptr(); *ptr } /// Gets the tracing id of the task containi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
521
571
tokio-rs/tokio:tokio/src/runtime/task/core.rs:15
Some(waker) => waker.wake_by_ref(), None => panic!("waker missing"), }); } } #[test] #[cfg(not(loom))] fn header_lte_cache_line() { assert!(std::mem::size_of::<Header>() <= 8 * std::mem::size_of::<*const ()>()); }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/core.rs
561
571
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
/// Either the future or the output. pub(super) stage: CoreStage<T>, } /// Crate public as this is also needed by the pool. #[repr(C)] pub(crate) struct Header { /// Task state. pub(super) state: State, /// Pointer to next task, used with the injection queue. pub(super) queue_next: UnsafeCell<Opti...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
pub(super) struct Trailer { /// Pointers for the linked list in the `OwnedTasks` that owns this task. pub(super) owned: linked_list::Pointers<Header>, /// Consumer task waiting on completion of this task. pub(super) waker: UnsafeCell<Option<Waker>>, /// Optional hooks needed in the harness. pub(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
) -> Header { Header { state, queue_next: UnsafeCell::new(None), vtable, owner_id: UnsafeCell::new(None), #[cfg(all(tokio_unstable, feature = "tracing"))] tracing_id, } } #[cfg(all(to...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:8
task_id: &Id, #[cfg(tokio_unstable)] spawn_location: &&'static Location<'static>, ) { let trailer_addr = trailer as *const Trailer as usize; let trailer_ptr = unsafe { Header::get_trailer(NonNull::from(header)) }; assert_eq!(trailer_addr, trail...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/core.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/core.rs:9
impl<T: Future> CoreStage<T> { pub(super) fn with_mut<R>(&self, f: impl FnOnce(*mut Stage<T>) -> R) -> R { self.stage.with_mut(f) } } /// Set and clear the task id in the context when the future is executed or /// dropped, or when the output produced by the future is dropped. pub(crate) struct TaskIdGu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/core.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/core.rs:10
pub(super) fn poll(&self, mut cx: Context<'_>) -> Poll<T::Output> { let res = { self.stage.stage.with_mut(|ptr| { // Safety: The caller ensures mutual exclusion to the field. let future = match unsafe { &mut *ptr } { Stage::Running(future) => futur...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/core.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/core.rs:11
/// The caller must ensure it is safe to mutate the `stage` field. pub(super) fn store_output(&self, output: super::Result<T::Output>) { // Safety: the caller ensures mutual exclusion to the field. unsafe { self.set_stage(Stage::Finished(output)); } } /// Takes the task ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/core.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/core.rs:12
self.owner_id.with_mut(|ptr| *ptr = Some(owner)); } pub(super) fn get_owner_id(&self) -> Option<NonZeroU64> { // safety: If there are concurrent writes, then that write has violated // the safety requirements on `set_owner_id`. unsafe { self.owner_id.with(|ptr| *ptr) } } /// Ge...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/core.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/core.rs:13
let offset = me.as_ref().vtable.id_offset; let id = me.as_ptr().cast::<u8>().add(offset).cast::<Id>(); NonNull::new_unchecked(id) } /// Gets the id of the task containing this `Header`. /// /// # Safety /// /// The provided raw pointer must point at the header of a task. pub...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/core.rs
481
540
tokio-rs/tokio:tokio/src/runtime/task/core.rs:14
#[cfg(tokio_unstable)] pub(super) unsafe fn get_spawn_location(me: NonNull<Header>) -> &'static Location<'static> { let ptr = Header::get_spawn_location_ptr(me).as_ptr(); *ptr } /// Gets the tracing id of the task containing this `Header`. /// /// # Safety /// /// The provid...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/core.rs
521
570
tokio-rs/tokio:tokio/src/runtime/task/core.rs:15
None => panic!("waker missing"), }); } } #[test] #[cfg(not(loom))] fn header_lte_cache_line() { assert!(std::mem::size_of::<Header>() <= 8 * std::mem::size_of::<*const ()>()); }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/core.rs
561
570
tokio-rs/tokio:tokio/src/runtime/task/core.rs:1
//! Core task module. //! //! # Safety //! //! The functions in this module are private to the `task` module. All of them //! should be considered `unsafe` to use, but are not marked as such since it //! would be too noisy. //! //! Make sure to consult the relevant safety section of each function before //! use. use c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/core.rs:2
// Sources: // - https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-optimization-manual.pdf // - https://github.com/facebook/folly/blob/1b5288e6eea6df074758f877c849b6e73bbb9fbb/folly/lang/Align.h#L107 // // ARM's big.LITTLE architecture has asymmetric cores and "big" cores have ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
// m68k has 16-byte cache line size. // // Sources: // - https://github.com/torvalds/linux/blob/3516bd729358a2a9b090c1905bd2a3fa926e24c6/arch/m68k/include/asm/cache.h#L9 #[cfg_attr(target_arch = "m68k", repr(align(16)))] // s390x has 256-byte cache line size. // // Sources: // - https://github.com/golang/go/blob/3dd586...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
/// Either the future or output, depending on the execution stage. pub(super) core: Core<T, S>, /// Cold data pub(super) trailer: Trailer, } pub(super) struct CoreStage<T: Future> { stage: UnsafeCell<Stage<T>>, } /// The core of the task. /// /// Holds the future or output, depending on the stage of ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
pub(super) state: State, /// Pointer to next task, used with the injection queue. pub(super) queue_next: UnsafeCell<Option<NonNull<Header>>>, /// Table of function pointers for executing actions on the task. pub(super) vtable: &'static Vtable, /// This integer contains the id of the `OwnedTasks` ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
generate_addr_of_methods! { impl<> Trailer { pub(super) unsafe fn addr_of_owned(self: NonNull<Self>) -> NonNull<linked_list::Pointers<Header>> { &self.owned } } } /// Either the future or the output. #[repr(C)] // https://github.com/rust-lang/miri/issues/3780 pub(super) enum Stage<T...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
} #[cfg(all(tokio_unstable, feature = "tracing"))] let tracing_id = future.id(); let vtable = raw::vtable::<T, S>(); let result = Box::new(Cell { trailer: Trailer::new(scheduler.hooks()), header: new_header( state, vtable, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:8
assert_eq!(scheduler_addr, scheduler_ptr.as_ptr() as usize); let id_addr = task_id as *const Id as usize; let id_ptr = unsafe { Header::get_id_ptr(NonNull::from(header)) }; assert_eq!(id_addr, id_ptr.as_ptr() as usize); #[cfg(tokio_unstable)] ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/core.rs:9
parent_task_id: Option<Id>, } impl TaskIdGuard { fn enter(id: Id) -> Self { TaskIdGuard { parent_task_id: context::set_current_task_id(Some(id)), } } } impl Drop for TaskIdGuard { fn drop(&mut self) { context::set_current_task_id(self.parent_task_id); } } impl<T: F...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/core.rs:10
// Safety: The caller ensures the future is pinned. let future = unsafe { Pin::new_unchecked(future) }; let _guard = TaskIdGuard::enter(self.task_id); future.poll(&mut cx) }) }; if res.is_ready() { self.drop_future_or_output(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/core.rs:11
/// /// # Safety /// /// The caller must ensure it is safe to mutate the `stage` field. pub(super) fn take_output(&self) -> super::Result<T::Output> { use std::mem; self.stage.stage.with_mut(|ptr| { // Safety:: the caller ensures mutual exclusion to the field. ma...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/core.rs:12
/// Gets a pointer to the `Trailer` of the task containing this `Header`. /// /// # Safety /// /// The provided raw pointer must point at the header of a task. pub(super) unsafe fn get_trailer(me: NonNull<Header>) -> NonNull<Trailer> { let offset = me.as_ref().vtable.trailer_offset; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/core.rs:13
/// The provided raw pointer must point at the header of a task. pub(super) unsafe fn get_id(me: NonNull<Header>) -> Id { let ptr = Header::get_id_ptr(me).as_ptr(); *ptr } /// Gets a pointer to the source code location where the task containing /// this `Header` was spawned. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
481
540
tokio-rs/tokio:tokio/src/runtime/task/core.rs:14
/// /// The provided raw pointer must point at the header of a task. #[cfg(all(tokio_unstable, feature = "tracing"))] pub(super) unsafe fn get_tracing_id(me: &NonNull<Header>) -> Option<&tracing::Id> { me.as_ref().tracing_id.as_ref() } } impl Trailer { fn new(hooks: TaskHarnessScheduleHooks...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/core.rs
521
561
tokio-rs/tokio:tokio/src/runtime/task/core.rs:1
//! Core task module. //! //! # Safety //! //! The functions in this module are private to the `task` module. All of them //! should be considered `unsafe` to use, but are not marked as such since it //! would be too noisy. //! //! Make sure to consult the relevant safety section of each function before //! use. use c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/core.rs:2
// - https://github.com/facebook/folly/blob/1b5288e6eea6df074758f877c849b6e73bbb9fbb/folly/lang/Align.h#L107 // // ARM's big.LITTLE architecture has asymmetric cores and "big" cores have 128-byte cache line size. // // Sources: // - https://www.mono-project.com/news/2016/09/12/arm64-icache/ // // powerpc64 has 128-byte...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
// Sources: // - https://github.com/torvalds/linux/blob/3516bd729358a2a9b090c1905bd2a3fa926e24c6/arch/m68k/include/asm/cache.h#L9 #[cfg_attr(target_arch = "m68k", repr(align(16)))] // s390x has 256-byte cache line size. // // Sources: // - https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
/// Cold data pub(super) trailer: Trailer, } pub(super) struct CoreStage<T: Future> { stage: UnsafeCell<Stage<T>>, } /// The core of the task. /// /// Holds the future or output, depending on the stage of execution. /// /// Any changes to the layout of this struct _must_ also be reflected in the /// `const` f...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
/// that this task is stored in. If the task is not in any list, should be /// the id of the list that it was previously in, or `None` if it has never /// been in any list. /// /// Once a task has been bound to a list, it can never be bound to another /// list, even if removed from the first list. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
#[repr(C)] // https://github.com/rust-lang/miri/issues/3780 pub(super) enum Stage<T: Future> { Running(T), Finished(super::Result<T::Output>), Consumed, } impl<T: Future, S: Schedule> Cell<T, S> { /// Allocates a new task cell, containing the header, trailer, and core /// structures. pub(super)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
stage: CoreStage { stage: UnsafeCell::new(Stage::Running(future)), }, task_id, }, }); #[cfg(debug_assertions)] { // Using a separate function for this code avoids instantiating it separately for every `T`. u...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:8
} } /// Set and clear the task id in the context when the future is executed or /// dropped, or when the output produced by the future is dropped. pub(crate) struct TaskIdGuard { parent_task_id: Option<Id>, } impl TaskIdGuard { fn enter(id: Id) -> Self { TaskIdGuard { parent_task_id: conte...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/core.rs:9
// Safety: The caller ensures mutual exclusion to the field. let future = match unsafe { &mut *ptr } { Stage::Running(future) => future, _ => unreachable!("unexpected stage"), }; // Safety: The caller ensures the future is pinned. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/core.rs:10
unsafe { self.set_stage(Stage::Finished(output)); } } /// Takes the task output. /// /// # Safety /// /// The caller must ensure it is safe to mutate the `stage` field. pub(super) fn take_output(&self) -> super::Result<T::Output> { use std::mem; self.sta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/core.rs:11
pub(super) fn get_owner_id(&self) -> Option<NonZeroU64> { // safety: If there are concurrent writes, then that write has violated // the safety requirements on `set_owner_id`. unsafe { self.owner_id.with(|ptr| *ptr) } } /// Gets a pointer to the `Trailer` of the task containing this `He...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/core.rs:12
} /// Gets the id of the task containing this `Header`. /// /// # Safety /// /// The provided raw pointer must point at the header of a task. pub(super) unsafe fn get_id(me: NonNull<Header>) -> Id { let ptr = Header::get_id_ptr(me).as_ptr(); *ptr } /// Gets the tracing ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
441
496
tokio-rs/tokio:tokio/src/runtime/task/core.rs:13
.with(|ptr| (*ptr).as_ref().unwrap().will_wake(waker)) } pub(super) fn wake_join(&self) { self.waker.with(|ptr| match unsafe { &*ptr } { Some(waker) => waker.wake_by_ref(), None => panic!("waker missing"), }); } } #[test] #[cfg(not(loom))] fn header_lte_cache_line()...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/core.rs
481
496
tokio-rs/tokio:tokio/src/runtime/task/core.rs:1
//! Core task module. //! //! # Safety //! //! The functions in this module are private to the `task` module. All of them //! should be considered `unsafe` to use, but are not marked as such since it //! would be too noisy. //! //! Make sure to consult the relevant safety section of each function before //! use. use c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
17819062e27b48570dd7f510b8bf8cf7b0e52cf4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/17819062e27b48570dd7f510b8bf8cf7b0e52cf4/tokio/src/runtime/task/core.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
/// that this task is stored in. If the task is not in any list, should be /// the id of the list that it was previously in, or `None` if it has never /// been in any list. /// /// Once a task has been bound to a list, it can never be bound to another /// list, even if removed from the first list. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
17819062e27b48570dd7f510b8bf8cf7b0e52cf4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/17819062e27b48570dd7f510b8bf8cf7b0e52cf4/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
Running(T), Finished(super::Result<T::Output>), Consumed, } impl<T: Future, S: Schedule> Cell<T, S> { /// Allocates a new task cell, containing the header, trailer, and core /// structures. pub(super) fn new(future: T, scheduler: S, state: State, task_id: Id) -> Box<Cell<T, S>> { // Separat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
17819062e27b48570dd7f510b8bf8cf7b0e52cf4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/17819062e27b48570dd7f510b8bf8cf7b0e52cf4/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
task_id, }, trailer: Trailer::new(), }); #[cfg(debug_assertions)] { // Using a separate function for this code avoids instantiating it separately for every `T`. unsafe fn check<S>(header: &Header, trailer: &Trailer, scheduler: &S, task_id: &Id) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
17819062e27b48570dd7f510b8bf8cf7b0e52cf4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/17819062e27b48570dd7f510b8bf8cf7b0e52cf4/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:8
/// Set and clear the task id in the context when the future is executed or /// dropped, or when the output produced by the future is dropped. pub(crate) struct TaskIdGuard { parent_task_id: Option<Id>, } impl TaskIdGuard { fn enter(id: Id) -> Self { TaskIdGuard { parent_task_id: context::s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
17819062e27b48570dd7f510b8bf8cf7b0e52cf4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/17819062e27b48570dd7f510b8bf8cf7b0e52cf4/tokio/src/runtime/task/core.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/core.rs:9
Stage::Running(future) => future, _ => unreachable!("unexpected stage"), }; // Safety: The caller ensures the future is pinned. let future = unsafe { Pin::new_unchecked(future) }; let _guard = TaskIdGuard::enter(self.task_id); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
17819062e27b48570dd7f510b8bf8cf7b0e52cf4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/17819062e27b48570dd7f510b8bf8cf7b0e52cf4/tokio/src/runtime/task/core.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/core.rs:10
} } /// Takes the task output. /// /// # Safety /// /// The caller must ensure it is safe to mutate the `stage` field. pub(super) fn take_output(&self) -> super::Result<T::Output> { use std::mem; self.stage.stage.with_mut(|ptr| { // Safety:: the caller ensures m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
17819062e27b48570dd7f510b8bf8cf7b0e52cf4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/17819062e27b48570dd7f510b8bf8cf7b0e52cf4/tokio/src/runtime/task/core.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/core.rs:11
// the safety requirements on `set_owner_id`. unsafe { self.owner_id.with(|ptr| *ptr) } } /// Gets a pointer to the `Trailer` of the task containing this `Header`. /// /// # Safety /// /// The provided raw pointer must point at the header of a task. pub(super) unsafe fn get_trailer(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
17819062e27b48570dd7f510b8bf8cf7b0e52cf4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/17819062e27b48570dd7f510b8bf8cf7b0e52cf4/tokio/src/runtime/task/core.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/core.rs:12
/// Gets the id of the task containing this `Header`. /// /// # Safety /// /// The provided raw pointer must point at the header of a task. pub(super) unsafe fn get_id(me: NonNull<Header>) -> Id { let ptr = Header::get_id_ptr(me).as_ptr(); *ptr } /// Gets the tracing id of t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
17819062e27b48570dd7f510b8bf8cf7b0e52cf4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/17819062e27b48570dd7f510b8bf8cf7b0e52cf4/tokio/src/runtime/task/core.rs
441
493
tokio-rs/tokio:tokio/src/runtime/task/core.rs:13
pub(super) fn wake_join(&self) { self.waker.with(|ptr| match unsafe { &*ptr } { Some(waker) => waker.wake_by_ref(), None => panic!("waker missing"), }); } } #[test] #[cfg(not(loom))] fn header_lte_cache_line() { assert!(std::mem::size_of::<Header>() <= 8 * std::mem::size...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
17819062e27b48570dd7f510b8bf8cf7b0e52cf4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/17819062e27b48570dd7f510b8bf8cf7b0e52cf4/tokio/src/runtime/task/core.rs
481
493
tokio-rs/tokio:tokio/src/runtime/task/core.rs:12
/// Gets the id of the task containing this `Header`. /// /// # Safety /// /// The provided raw pointer must point at the header of a task. pub(super) unsafe fn get_id(me: NonNull<Header>) -> Id { let ptr = Header::get_id_ptr(me).as_ptr(); *ptr } /// Gets the tracing id of t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3/tokio/src/runtime/task/core.rs
441
495
tokio-rs/tokio:tokio/src/runtime/task/core.rs:13
pub(super) fn wake_join(&self) { self.waker.with(|ptr| match unsafe { &*ptr } { Some(waker) => waker.wake_by_ref(), None => panic!("waker missing"), }); } } #[test] #[cfg(not(loom))] fn header_lte_cache_line() { use std::mem::size_of; assert!(size_of::<Header>() <= ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3/tokio/src/runtime/task/core.rs
481
495
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
/// that this task is stored in. If the task is not in any list, should be /// the id of the list that it was previously in, or `None` if it has never /// been in any list. /// /// Once a task has been bound to a list, it can never be bound to another /// list, even if removed from the first list. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
Finished(super::Result<T::Output>), Consumed, } impl<T: Future, S: Schedule> Cell<T, S> { /// Allocates a new task cell, containing the header, trailer, and core /// structures. pub(super) fn new(future: T, scheduler: S, state: State, task_id: Id) -> Box<Cell<T, S>> { // Separated into a non-ge...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
}, trailer: Trailer::new(), }); #[cfg(debug_assertions)] { // Using a separate function for this code avoids instantiating it separately for every `T`. unsafe fn check<S>(header: &Header, trailer: &Trailer, scheduler: &S, task_id: &Id) { let t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/core.rs
241
300