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/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
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/core.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/core.rs:9
_ => 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); future.poll(&mut cx) }) }...
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
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 mutual ...
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
361
420
tokio-rs/tokio:tokio/src/runtime/task/core.rs:11
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(me: NonNull<Header>) -> NonNull<Trailer> { let...
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
401
460
tokio-rs/tokio:tokio/src/runtime/task/core.rs:12
/// /// # 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 the task containing this `Header`. /// /// # Safety...
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
441
494
tokio-rs/tokio:tokio/src/runtime/task/core.rs:13
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>() <= 8 * size_of::<*const ()>()); }
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
481
494
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
c7e7f203eeb3190a556cf312bc4770e6d3363b69
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7e7f203eeb3190a556cf312bc4770e6d3363b69/tokio/src/runtime/task/core.rs
1
60
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
c7e7f203eeb3190a556cf312bc4770e6d3363b69
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7e7f203eeb3190a556cf312bc4770e6d3363b69/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 fns...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
c7e7f203eeb3190a556cf312bc4770e6d3363b69
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7e7f203eeb3190a556cf312bc4770e6d3363b69/tokio/src/runtime/task/core.rs
121
180
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 fns...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
/// 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
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/core.rs
161
220
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 mutual ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
1c428cc558bd3be71fcd9466010b2ff0ed4048b6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1c428cc558bd3be71fcd9466010b2ff0ed4048b6/tokio/src/runtime/task/core.rs
361
420
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
f24b9824e67f833bc78a5a08527cb48a8d053c66
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f24b9824e67f833bc78a5a08527cb48a8d053c66/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
f24b9824e67f833bc78a5a08527cb48a8d053c66
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f24b9824e67f833bc78a5a08527cb48a8d053c66/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
), repr(align(32)) )] // 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...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
f24b9824e67f833bc78a5a08527cb48a8d053c66
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f24b9824e67f833bc78a5a08527cb48a8d053c66/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
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, } pub(super) struct CoreStage<T: Future> { stage: UnsafeCell...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
f24b9824e67f833bc78a5a08527cb48a8d053c66
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f24b9824e67f833bc78a5a08527cb48a8d053c66/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
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 or LocalOwnedTasks that /// this task is stored in. If the task is not in any list, shoul...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
f24b9824e67f833bc78a5a08527cb48a8d053c66
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f24b9824e67f833bc78a5a08527cb48a8d053c66/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
} } /// Either the future or the output. 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) fn new(future: T,...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
f24b9824e67f833bc78a5a08527cb48a8d053c66
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f24b9824e67f833bc78a5a08527cb48a8d053c66/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
core: Core { scheduler, stage: CoreStage { stage: UnsafeCell::new(Stage::Running(future)), }, task_id, }, trailer: Trailer::new(), }); #[cfg(debug_assertions)] { // Using a se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
f24b9824e67f833bc78a5a08527cb48a8d053c66
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f24b9824e67f833bc78a5a08527cb48a8d053c66/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:10
/// 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
f24b9824e67f833bc78a5a08527cb48a8d053c66
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f24b9824e67f833bc78a5a08527cb48a8d053c66/tokio/src/runtime/task/core.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/core.rs:11
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
f24b9824e67f833bc78a5a08527cb48a8d053c66
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f24b9824e67f833bc78a5a08527cb48a8d053c66/tokio/src/runtime/task/core.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/core.rs:12
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
f24b9824e67f833bc78a5a08527cb48a8d053c66
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f24b9824e67f833bc78a5a08527cb48a8d053c66/tokio/src/runtime/task/core.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/core.rs:13
pub(super) unsafe fn will_wake(&self, waker: &Waker) -> bool { self.waker .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 => pani...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
f24b9824e67f833bc78a5a08527cb48a8d053c66
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f24b9824e67f833bc78a5a08527cb48a8d053c66/tokio/src/runtime/task/core.rs
481
500
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
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/core.rs:2
// // 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 cache line size. // // Sources: // - https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
repr(align(32)) )] // 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/go...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
/// 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, } pub(super) struct CoreStage<T: Future> { stage: UnsafeCell<Stage<T>>, } /// The core of the task. //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
/// Table of function pointers for executing actions on the task. pub(super) vtable: &'static Vtable, /// This integer contains the id of the OwnedTasks or LocalOwnedTasks 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 zer...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
} /// Either the future or the output. 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) fn new(future: T, s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
scheduler, stage: CoreStage { stage: UnsafeCell::new(Stage::Running(future)), }, task_id, }, trailer: Trailer::new(), }); #[cfg(debug_assertions)] { // Using a separate function for this code...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:8
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 TaskIdGuard { parent_task_id: Option<Id...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/core.rs:9
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) => future, _ => unreachable!("unexpected stage"), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/core.rs:10
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 output. /// /// # Safety /// /// The caller must ensure...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/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) -> u64 { // 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 `Header`. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/core.rs:12
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(super) unsafe fn get_id(me: NonNull<Header>) -> Id...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
441
499
tokio-rs/tokio:tokio/src/runtime/task/core.rs:13
self.waker .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 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/task/core.rs
481
499
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
/// Table of function pointers for executing actions on the task. pub(super) vtable: &'static Vtable, /// This integer contains the id of the OwnedTasks or LocalOwnedTasks 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 zer...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
2e62374e4a643015ea9ecf5a1d012c3429eed42f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2e62374e4a643015ea9ecf5a1d012c3429eed42f/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
} /// Either the future or the output. 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) fn new(future: T, s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
2e62374e4a643015ea9ecf5a1d012c3429eed42f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2e62374e4a643015ea9ecf5a1d012c3429eed42f/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
let trailer_ptr = unsafe { Header::get_trailer(NonNull::from(&result.header)) }; assert_eq!(trailer_addr, trailer_ptr.as_ptr() as usize); let scheduler_addr = (&result.core.scheduler) as *const S as usize; let scheduler_ptr = unsafe { Header::get_scheduler::<S>(NonNu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
2e62374e4a643015ea9ecf5a1d012c3429eed42f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2e62374e4a643015ea9ecf5a1d012c3429eed42f/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:8
} } impl<T: Future, S: Schedule> Core<T, S> { /// Polls the future. /// /// # Safety /// /// The caller must ensure it is safe to mutate the `state` field. This /// requires ensuring mutual exclusion between any concurrent thread that /// might modify the future or output field. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
2e62374e4a643015ea9ecf5a1d012c3429eed42f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2e62374e4a643015ea9ecf5a1d012c3429eed42f/tokio/src/runtime/task/core.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/core.rs:9
/// Drops the future. /// /// # Safety /// /// The caller must ensure it is safe to mutate the `stage` field. pub(super) fn drop_future_or_output(&self) { // Safety: the caller ensures mutual exclusion to the field. unsafe { self.set_stage(Stage::Consumed); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
2e62374e4a643015ea9ecf5a1d012c3429eed42f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2e62374e4a643015ea9ecf5a1d012c3429eed42f/tokio/src/runtime/task/core.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/core.rs:10
} unsafe fn set_stage(&self, stage: Stage<T>) { let _guard = TaskIdGuard::enter(self.task_id); self.stage.stage.with_mut(|ptr| *ptr = stage) } } impl Header { pub(super) unsafe fn set_next(&self, next: Option<NonNull<Header>>) { self.queue_next.with_mut(|ptr| *ptr = next); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
2e62374e4a643015ea9ecf5a1d012c3429eed42f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2e62374e4a643015ea9ecf5a1d012c3429eed42f/tokio/src/runtime/task/core.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/core.rs:11
/// /// The provided raw pointer must point at the header of a task. /// /// The generic type S must be set to the correct scheduler type for this /// task. pub(super) unsafe fn get_scheduler<S>(me: NonNull<Header>) -> NonNull<S> { let offset = me.as_ref().vtable.scheduler_offset; le...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
2e62374e4a643015ea9ecf5a1d012c3429eed42f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2e62374e4a643015ea9ecf5a1d012c3429eed42f/tokio/src/runtime/task/core.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/core.rs:12
} } impl Trailer { pub(super) unsafe fn set_waker(&self, waker: Option<Waker>) { self.waker.with_mut(|ptr| { *ptr = waker; }); } pub(super) unsafe fn will_wake(&self, waker: &Waker) -> bool { self.waker .with(|ptr| (*ptr).as_ref().unwrap().will_wake(waker)) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
2e62374e4a643015ea9ecf5a1d012c3429eed42f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2e62374e4a643015ea9ecf5a1d012c3429eed42f/tokio/src/runtime/task/core.rs
441
470
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
93bde0870fd706afbca795b94ce6e46d1f878edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/core.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/core.rs:2
} 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 fns in raw.rs. #[repr(C)] pub(super) struct Core<T...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
93bde0870fd706afbca795b94ce6e46d1f878edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
/// /// Once a task has been bound to a list, it can never be bound to another /// list, even if removed from the first list. /// /// The id is not unset when removed from a list because we want to be able /// to read the id without synchronization, even if it is concurrently being /// removed f...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
93bde0870fd706afbca795b94ce6e46d1f878edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
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>> { #[cfg(all(tokio_unstable, feature = "tracing"))] let tracing_id = futur...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
93bde0870fd706afbca795b94ce6e46d1f878edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
let id_addr = (&result.core.task_id) as *const Id as usize; let id_ptr = unsafe { Header::get_id_ptr(NonNull::from(&result.header)) }; assert_eq!(id_addr, id_ptr.as_ptr() as usize); } result } } impl<T: Future> CoreStage<T> { pub(super) fn with_mut<R>(&self, f: impl FnO...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
93bde0870fd706afbca795b94ce6e46d1f878edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
/// The caller must ensure it is safe to mutate the `state` field. This /// requires ensuring mutual exclusion between any concurrent thread that /// might modify the future or output field. /// /// The mutual exclusion is implemented by `Harness` and the `Lifecycle` /// component of the task state....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
93bde0870fd706afbca795b94ce6e46d1f878edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
unsafe { self.set_stage(Stage::Consumed); } } /// Stores the task output. /// /// # Safety /// /// 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 m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
93bde0870fd706afbca795b94ce6e46d1f878edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:8
impl Header { pub(super) unsafe fn set_next(&self, next: Option<NonNull<Header>>) { self.queue_next.with_mut(|ptr| *ptr = next); } // safety: The caller must guarantee exclusive access to this field, and // must ensure that the id is either 0 or the id of the OwnedTasks // containing this t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
93bde0870fd706afbca795b94ce6e46d1f878edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/core.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/core.rs:9
NonNull::new_unchecked(scheduler) } /// Gets a pointer to 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_ptr(me: NonNull<Header>) -> NonNull<Id> { let offset = me.as_ref()...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
93bde0870fd706afbca795b94ce6e46d1f878edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/core.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/core.rs:10
} pub(super) unsafe fn will_wake(&self, waker: &Waker) -> bool { self.waker .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 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
93bde0870fd706afbca795b94ce6e46d1f878edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/core.rs
361
382
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
unsafe { self.set_stage(Stage::Consumed); } } /// Stores the task output. /// /// # Safety /// /// 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 m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:8
cfg_rt_multi_thread! { impl Header { pub(super) unsafe fn set_next(&self, next: Option<NonNull<Header>>) { self.queue_next.with_mut(|ptr| *ptr = next); } } } impl Header { // safety: The caller must guarantee exclusive access to this field, and // must ensure that the id is ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/core.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/core.rs:9
/// task. pub(super) unsafe fn get_scheduler<S>(me: NonNull<Header>) -> NonNull<S> { let offset = me.as_ref().vtable.scheduler_offset; let scheduler = me.as_ptr().cast::<u8>().add(offset).cast::<S>(); NonNull::new_unchecked(scheduler) } /// Gets a pointer to the id of the task conta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/core.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/core.rs:10
pub(super) unsafe fn set_waker(&self, waker: Option<Waker>) { self.waker.with_mut(|ptr| { *ptr = waker; }); } pub(super) unsafe fn will_wake(&self, waker: &Waker) -> bool { self.waker .with(|ptr| (*ptr).as_ref().unwrap().will_wake(waker)) } pub(super) fn...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/core.rs
361
386
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
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/core.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/core.rs:2
stage: UnsafeCell<Stage<T>>, } /// The core of the task. /// /// Holds the future or output, depending on the stage of execution. pub(super) struct Core<T: Future, S> { /// Scheduler used to drive this future. pub(super) scheduler: S, /// Either the future or the output. pub(super) stage: CoreStage<T>...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
pub(super) owner_id: UnsafeCell<u64>, /// The tracing ID for this instrumented task. #[cfg(all(tokio_unstable, feature = "tracing"))] pub(super) id: Option<tracing::Id>, } unsafe impl Send for Header {} unsafe impl Sync for Header {} /// Cold data is stored after the future. Data is considered cold if it...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
let result = Box::new(Cell { header: Header { state, queue_next: UnsafeCell::new(None), vtable: raw::vtable::<T, S>(), owner_id: UnsafeCell::new(0), #[cfg(all(tokio_unstable, feature = "tracing"))] id, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
} /// 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 mutual ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:8
pub(super) fn get_owner_id(&self) -> u64 { // 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 `Header`. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/core.rs
281
326
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
9e3fb1673a73046363af64c09a040eeed67f2a4c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e3fb1673a73046363af64c09a040eeed67f2a4c/tokio/src/runtime/task/core.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/core.rs:2
} /// The core of the task. /// /// Holds the future or output, depending on the stage of execution. pub(super) struct Core<T: Future, S> { /// Scheduler used to drive this future. pub(super) scheduler: S, /// Either the future or the output. pub(super) stage: CoreStage<T>, /// The task's ID, use...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
9e3fb1673a73046363af64c09a040eeed67f2a4c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e3fb1673a73046363af64c09a040eeed67f2a4c/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
/// The tracing ID for this instrumented task. #[cfg(all(tokio_unstable, feature = "tracing"))] pub(super) id: Option<tracing::Id>, } unsafe impl Send for Header {} unsafe impl Sync for Header {} /// Cold data is stored after the future. Data is considered cold if it is only /// used during creation or shutdo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
9e3fb1673a73046363af64c09a040eeed67f2a4c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e3fb1673a73046363af64c09a040eeed67f2a4c/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
header: Header { state, queue_next: UnsafeCell::new(None), vtable: raw::vtable::<T, S>(), owner_id: UnsafeCell::new(0), #[cfg(all(tokio_unstable, feature = "tracing"))] id, }, core: Core { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
9e3fb1673a73046363af64c09a040eeed67f2a4c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e3fb1673a73046363af64c09a040eeed67f2a4c/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
/// Polls the future. /// /// # Safety /// /// The caller must ensure it is safe to mutate the `state` field. This /// requires ensuring mutual exclusion between any concurrent thread that /// might modify the future or output field. /// /// The mutual exclusion is implemented by `Harnes...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
9e3fb1673a73046363af64c09a040eeed67f2a4c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e3fb1673a73046363af64c09a040eeed67f2a4c/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
/// The caller must ensure it is safe to mutate the `stage` field. pub(super) fn drop_future_or_output(&self) { // Safety: the caller ensures mutual exclusion to the field. unsafe { self.set_stage(Stage::Consumed); } } /// Stores the task output. /// /// # Safety...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
9e3fb1673a73046363af64c09a040eeed67f2a4c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e3fb1673a73046363af64c09a040eeed67f2a4c/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
} cfg_rt_multi_thread! { impl Header { pub(super) unsafe fn set_next(&self, next: Option<NonNull<Header>>) { self.queue_next.with_mut(|ptr| *ptr = next); } } } impl Header { // safety: The caller must guarantee exclusive access to this field, and // must ensure that the id ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
9e3fb1673a73046363af64c09a040eeed67f2a4c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e3fb1673a73046363af64c09a040eeed67f2a4c/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:8
}); } pub(super) unsafe fn will_wake(&self, waker: &Waker) -> bool { self.waker .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(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
9e3fb1673a73046363af64c09a040eeed67f2a4c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e3fb1673a73046363af64c09a040eeed67f2a4c/tokio/src/runtime/task/core.rs
281
303
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
header: Header { state, queue_next: UnsafeCell::new(None), vtable: raw::vtable::<T, S>(), owner_id: UnsafeCell::new(0), #[cfg(all(tokio_unstable, feature = "tracing"))] id, }, core: Core { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
228d4fce992124fc646a2e49606a65847166413c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
/// # Safety /// /// The caller must ensure it is safe to mutate the `state` field. This /// requires ensuring mutual exclusion between any concurrent thread that /// might modify the future or output field. /// /// The mutual exclusion is implemented by `Harness` and the `Lifecycle` /// com...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
228d4fce992124fc646a2e49606a65847166413c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
// Safety: the caller ensures mutual exclusion to the field. unsafe { self.set_stage(Stage::Consumed); } } /// Stores the task output. /// /// # Safety /// /// The caller must ensure it is safe to mutate the `stage` field. pub(super) fn store_output(&self, output...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
228d4fce992124fc646a2e49606a65847166413c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
cfg_rt_multi_thread! { impl Header { pub(super) unsafe fn set_next(&self, next: Option<NonNull<Header>>) { self.queue_next.with_mut(|ptr| *ptr = next); } } } impl Header { // safety: The caller must guarantee exclusive access to this field, and // must ensure that the id is ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
228d4fce992124fc646a2e49606a65847166413c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/core.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/core.rs:2
} /// The core of the task. /// /// Holds the future or output, depending on the stage of execution. pub(super) struct Core<T: Future, S> { /// Scheduler used to drive this future. pub(super) scheduler: S, /// Either the future or the output. pub(super) stage: CoreStage<T>, /// The task's ID, use...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
6f048ca954aa5f285f1cf6310d447e7c079c1c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
/// removed from the list. pub(super) owner_id: UnsafeCell<u64>, /// The tracing ID for this instrumented task. #[cfg(all(tokio_unstable, feature = "tracing"))] pub(super) id: Option<tracing::Id>, } generate_addr_of_methods! { impl<> Header { pub(super) unsafe fn addr_of_owned(self: NonNul...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
6f048ca954aa5f285f1cf6310d447e7c079c1c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
state, owned: linked_list::Pointers::new(), queue_next: UnsafeCell::new(None), vtable: raw::vtable::<T, S>(), owner_id: UnsafeCell::new(0), #[cfg(all(tokio_unstable, feature = "tracing"))] id, }, core...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
6f048ca954aa5f285f1cf6310d447e7c079c1c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
pub(super) fn poll(&self, mut cx: Context<'_>) -> Poll<T::Output> { let res = { self.stage.with_mut(|ptr| { // Safety: The caller ensures mutual exclusion to the field. let future = match unsafe { &mut *ptr } { Stage::Running(future) => future, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
6f048ca954aa5f285f1cf6310d447e7c079c1c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
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 output. /// /// # Safety /// /// The caller must ensure...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
6f048ca954aa5f285f1cf6310d447e7c079c1c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
// containing this task. pub(super) unsafe fn set_owner_id(&self, owner: u64) { self.owner_id.with_mut(|ptr| *ptr = owner); } pub(super) fn get_owner_id(&self) -> u64 { // safety: If there are concurrent writes, then that write has violated // the safety requirements on `set_owner_i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
6f048ca954aa5f285f1cf6310d447e7c079c1c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/core.rs
241
279
tokio-rs/tokio:tokio/src/runtime/task/core.rs:2
} /// The core of the task. /// /// Holds the future or output, depending on the stage of execution. pub(super) struct Core<T: Future, S> { /// Scheduler used to drive this future. pub(super) scheduler: S, /// Either the future or the output. pub(super) stage: CoreStage<T>, /// The task's ID, use...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
/// removed from the list. pub(super) owner_id: UnsafeCell<u64>, /// The tracing ID for this instrumented task. #[cfg(all(tokio_unstable, feature = "tracing"))] pub(super) id: Option<tracing::Id>, } unsafe impl Send for Header {} unsafe impl Sync for Header {} /// Cold data is stored after the future...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
core: Core { scheduler, stage: CoreStage { stage: UnsafeCell::new(Stage::Running(future)), }, task_id, }, trailer: Trailer { waker: UnsafeCell::new(None), }, }) } } impl<T...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
// Safety: The caller ensures the future is pinned. let future = unsafe { Pin::new_unchecked(future) }; future.poll(&mut cx) }) }; if res.is_ready() { self.drop_future_or_output(); } res } /// Drops the future. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
/// /// # 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.with_mut(|ptr| { // Safety:: the caller ensures mutual exclusion to the field. match me...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
unsafe { self.owner_id.with(|ptr| *ptr) } } } impl Trailer { pub(super) unsafe fn set_waker(&self, waker: Option<Waker>) { self.waker.with_mut(|ptr| { *ptr = waker; }); } pub(super) unsafe fn will_wake(&self, waker: &Waker) -> bool { self.waker .with(|pt...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/core.rs
241
271
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
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/core.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/core.rs:2
} /// The core of the task. /// /// Holds the future or output, depending on the stage of execution. pub(super) struct Core<T: Future, S> { /// Scheduler used to drive this future. pub(super) scheduler: S, /// Either the future or the output. pub(super) stage: CoreStage<T>, } /// Crate public as this...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
/// The tracing ID for this instrumented task. #[cfg(all(tokio_unstable, feature = "tracing"))] pub(super) id: Option<tracing::Id>, } unsafe impl Send for Header {} unsafe impl Sync for Header {} /// Cold data is stored after the future. pub(super) struct Trailer { /// Consumer task waiting on completion ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
stage: UnsafeCell::new(Stage::Running(future)), }, }, trailer: Trailer { waker: UnsafeCell::new(None), }, }) } } impl<T: Future> CoreStage<T> { pub(super) fn with_mut<R>(&self, f: impl FnOnce(*mut Stage<T>) -> R) -> R { self.st...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
future.poll(&mut cx) }) }; if res.is_ready() { self.drop_future_or_output(); } res } /// Drops the future. /// /// # Safety /// /// The caller must ensure it is safe to mutate the `stage` field. pub(super) fn drop_future_or_output(&s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/core.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/core.rs:6
pub(super) fn take_output(&self) -> super::Result<T::Output> { use std::mem; self.stage.with_mut(|ptr| { // Safety:: the caller ensures mutual exclusion to the field. match mem::replace(unsafe { &mut *ptr }, Stage::Consumed) { Stage::Finished(output) => output, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/core.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/core.rs:7
impl Trailer { pub(super) unsafe fn set_waker(&self, waker: Option<Waker>) { self.waker.with_mut(|ptr| { *ptr = waker; }); } pub(super) unsafe fn will_wake(&self, waker: &Waker) -> bool { self.waker .with(|ptr| (*ptr).as_ref().unwrap().will_wake(waker)) }...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/core.rs
241
267
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
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/core.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/core.rs:2
} /// The core of the task. /// /// Holds the future or output, depending on the stage of execution. pub(super) struct Core<T: Future, S> { /// Scheduler used to drive this future pub(super) scheduler: S, /// Either the future or the output pub(super) stage: CoreStage<T>, } /// Crate public as this i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/core.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/core.rs:3
/// The tracing ID for this instrumented task. #[cfg(all(tokio_unstable, feature = "tracing"))] pub(super) id: Option<tracing::Id>, } unsafe impl Send for Header {} unsafe impl Sync for Header {} /// Cold data is stored after the future. pub(super) struct Trailer { /// Consumer task waiting on completion ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/core.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/core.rs:4
stage: UnsafeCell::new(Stage::Running(future)), }, }, trailer: Trailer { waker: UnsafeCell::new(None), }, }) } } impl<T: Future> CoreStage<T> { pub(super) fn with_mut<R>(&self, f: impl FnOnce(*mut Stage<T>) -> R) -> R { self.st...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/core.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/core.rs:5
future.poll(&mut cx) }) }; if res.is_ready() { self.drop_future_or_output(); } res } /// Drop the future /// /// # Safety /// /// The caller must ensure it is safe to mutate the `stage` field. pub(super) fn drop_future_or_output(&sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/core.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/core.rs
161
220