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/mod.rs:2 | pub(crate) struct Task<S: 'static> {
raw: RawTask,
_p: PhantomData<S>,
}
unsafe impl<S> Send for Task<S> {}
unsafe impl<S> Sync for Task<S> {}
/// A task was notified.
#[repr(transparent)]
pub(crate) struct Notified<S: 'static>(Task<S>);
// safety: This type cannot be used to touch the task without first ver... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:3 | /// The task has completed work and is ready to be released. The scheduler
/// should release it immediately and return it. The task module will batch
/// the ref-dec with setting other options.
///
/// If the scheduler has already released the task, then None is returned.
fn release(&self, task: &T... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | let join = JoinHandle::new(raw);
(task, notified, join)
}
/// Create a new task with an associated join handle. This method is used
/// only when the task is not going to be stored in an `OwnedTasks` list.
///
/// Currently only blocking tasks use this method.
pub(crate) fn unowned<T, ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | }
}
cfg_rt_multi_thread! {
impl<S: 'static> Notified<S> {
unsafe fn from_raw(ptr: NonNull<Header>) -> Notified<S> {
Notified(Task::from_raw(ptr))
}
}
impl<S: 'static> Task<S> {
fn into_raw(self) -> NonNull<Header> {
let ret = self.header().into();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | impl<S: Schedule> UnownedTask<S> {
// Used in test of the inject queue.
#[cfg(test)]
pub(super) fn into_notified(self) -> Notified<S> {
Notified(self.into_task())
}
fn into_task(self) -> Task<S> {
// Convert into a task.
let task = Task {
raw: self.raw,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | }
}
}
impl<S: 'static> Drop for UnownedTask<S> {
fn drop(&mut self) {
// Decrement the ref count
if self.raw.header().state.ref_dec_twice() {
// Deallocate if this is the final ref count
self.raw.dealloc();
}
}
}
impl<S> fmt::Debug for Task<S> {
fn fmt(&... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/mod.rs | 241 | 286 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:1 | mod core;
use self::core::Cell;
pub(crate) use self::core::Header;
mod error;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::error::JoinError;
mod harness;
use self::harness::Harness;
cfg_rt_multi_thread! {
mod inject;
pub(super) use self::inject::Inject;
}
mod joi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:2 | pub(crate) struct Task<S: 'static> {
raw: RawTask,
_p: PhantomData<S>,
}
unsafe impl<S> Send for Task<S> {}
unsafe impl<S> Sync for Task<S> {}
/// A task was notified
#[repr(transparent)]
pub(crate) struct Notified<S: 'static>(Task<S>);
unsafe impl<S: Schedule> Send for Notified<S> {}
unsafe impl<S: Schedule... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:3 | /// notification.
fn new_task<T, S>(
task: T,
scheduler: S
) -> (Task<S>, Notified<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Future + 'static,
T::Output: 'static,
{
let raw = RawTask::new::<T, S>(task, scheduler);
let task = Task {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | impl<S: 'static> Task<S> {
pub(crate) unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
pub(crate) fn header(&self) -> &Header {
self.raw.header()
}
}
cfg_rt_multi_thread! {
impl<S: 'static... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | }
impl<S: Schedule> Notified<S> {
/// Run the task
pub(crate) fn run(self) {
self.0.raw.poll();
mem::forget(self);
}
/// Pre-emptively cancel the task as part of the shutdown process.
pub(crate) fn shutdown(self) {
self.0.shutdown();
}
}
impl<S: 'static> Drop for Task<... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/mod.rs | 161 | 217 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | unsafe impl<S> linked_list::Link for Task<S> {
type Handle = Task<S>;
type Target = Header;
fn as_raw(handle: &Task<S>) -> NonNull<Header> {
handle.header().into()
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::from_raw(ptr)
}
unsafe fn pointers(target: NonN... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/mod.rs | 201 | 217 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:1 | mod core;
use self::core::Cell;
pub(crate) use self::core::Header;
mod error;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::error::JoinError;
mod harness;
use self::harness::Harness;
cfg_rt_multi_thread! {
mod inject;
pub(super) use self::inject::Inject;
}
mod joi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6610ba9bd6b6a48d59f80573b5fa307972ace55a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6610ba9bd6b6a48d59f80573b5fa307972ace55a/tokio/src/runtime/task/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:2 | pub(crate) struct Task<S: 'static> {
raw: RawTask,
_p: PhantomData<S>,
}
unsafe impl<S> Send for Task<S> {}
unsafe impl<S> Sync for Task<S> {}
/// A task was notified
#[repr(transparent)]
pub(crate) struct Notified<S: 'static>(Task<S>);
unsafe impl<S: Schedule> Send for Notified<S> {}
unsafe impl<S: Schedule... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6610ba9bd6b6a48d59f80573b5fa307972ace55a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6610ba9bd6b6a48d59f80573b5fa307972ace55a/tokio/src/runtime/task/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:3 | }
}
cfg_rt! {
/// Create a new task with an associated join handle
pub(crate) fn joinable<T, S>(task: T) -> (Notified<S>, JoinHandle<T::Output>)
where
T: Future + Send + 'static,
S: Schedule,
{
let raw = RawTask::new::<_, S>(task);
let task = Task {
raw,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6610ba9bd6b6a48d59f80573b5fa307972ace55a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6610ba9bd6b6a48d59f80573b5fa307972ace55a/tokio/src/runtime/task/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | }
}
impl<S: 'static> Task<S> {
pub(crate) unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
pub(crate) fn header(&self) -> &Header {
self.raw.header()
}
}
cfg_rt_multi_thread! {
impl<S: 's... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6610ba9bd6b6a48d59f80573b5fa307972ace55a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6610ba9bd6b6a48d59f80573b5fa307972ace55a/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | pub(crate) fn shutdown(&self) {
self.raw.shutdown();
}
}
impl<S: Schedule> Notified<S> {
/// Run the task
pub(crate) fn run(self) {
self.0.raw.poll();
mem::forget(self);
}
/// Pre-emptively cancel the task as part of the shutdown process.
pub(crate) fn shutdown(self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6610ba9bd6b6a48d59f80573b5fa307972ace55a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6610ba9bd6b6a48d59f80573b5fa307972ace55a/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | /// # Safety
///
/// Tasks are pinned
unsafe impl<S> linked_list::Link for Task<S> {
type Handle = Task<S>;
type Target = Header;
fn as_raw(handle: &Task<S>) -> NonNull<Header> {
handle.header().into()
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::from_raw(ptr)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6610ba9bd6b6a48d59f80573b5fa307972ace55a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6610ba9bd6b6a48d59f80573b5fa307972ace55a/tokio/src/runtime/task/mod.rs | 201 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:1 | mod core;
use self::core::Cell;
pub(crate) use self::core::Header;
mod error;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::error::JoinError;
mod harness;
use self::harness::Harness;
cfg_rt_multi_thread! {
mod inject;
pub(super) use self::inject::Inject;
}
mod joi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 3b38ebd7f5d50611193f942c31c57262f263be33 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b38ebd7f5d50611193f942c31c57262f263be33/tokio/src/runtime/task/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:1 | mod core;
use self::core::Cell;
pub(crate) use self::core::Header;
mod error;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::error::JoinError;
mod harness;
use self::harness::Harness;
mod join;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e2589a0e401e27457618920e66caa0f14e9a69ad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e2589a0e401e27457618920e66caa0f14e9a69ad/tokio/src/runtime/task/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:2 | unsafe impl<S> Send for Task<S> {}
unsafe impl<S> Sync for Task<S> {}
/// A task was notified
#[repr(transparent)]
pub(crate) struct Notified<S: 'static>(Task<S>);
unsafe impl<S: Schedule> Send for Notified<S> {}
unsafe impl<S: Schedule> Sync for Notified<S> {}
/// Task result sent back
pub(crate) type Result<T> = s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e2589a0e401e27457618920e66caa0f14e9a69ad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e2589a0e401e27457618920e66caa0f14e9a69ad/tokio/src/runtime/task/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:3 | pub(crate) fn joinable<T, S>(task: T) -> (Notified<S>, JoinHandle<T::Output>)
where
T: Future + Send + 'static,
S: Schedule,
{
let raw = RawTask::new::<_, S>(task);
let task = Task {
raw,
_p: PhantomData,
};
let join = JoinHandle::new(raw... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e2589a0e401e27457618920e66caa0f14e9a69ad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e2589a0e401e27457618920e66caa0f14e9a69ad/tokio/src/runtime/task/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
pub(crate) fn header(&self) -> &Header {
self.raw.header()
}
}
cfg_rt_multi_thread! {
impl<S: 'static> Notified<S> {
pub(crate) unsafe fn from_raw(ptr: NonNull<Header>) -> Notified<S> {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e2589a0e401e27457618920e66caa0f14e9a69ad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e2589a0e401e27457618920e66caa0f14e9a69ad/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | self.raw.shutdown();
}
}
impl<S: Schedule> Notified<S> {
/// Run the task
pub(crate) fn run(self) {
self.0.raw.poll();
mem::forget(self);
}
/// Pre-emptively cancel the task as part of the shutdown process.
pub(crate) fn shutdown(self) {
self.0.shutdown();
}
}
impl... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e2589a0e401e27457618920e66caa0f14e9a69ad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e2589a0e401e27457618920e66caa0f14e9a69ad/tokio/src/runtime/task/mod.rs | 161 | 219 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | ///
/// Tasks are pinned
unsafe impl<S> linked_list::Link for Task<S> {
type Handle = Task<S>;
type Target = Header;
fn as_raw(handle: &Task<S>) -> NonNull<Header> {
handle.header().into()
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::from_raw(ptr)
}
unsafe... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e2589a0e401e27457618920e66caa0f14e9a69ad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e2589a0e401e27457618920e66caa0f14e9a69ad/tokio/src/runtime/task/mod.rs | 201 | 219 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:1 | mod core;
use self::core::Cell;
pub(crate) use self::core::Header;
mod error;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::error::JoinError;
mod harness;
use self::harness::Harness;
mod join;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e7d74b3119178b9b86f7b547774b6b121de2239a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:2 | }
unsafe impl<S> Send for Task<S> {}
unsafe impl<S> Sync for Task<S> {}
/// A task was notified
#[repr(transparent)]
pub(crate) struct Notified<S: 'static>(Task<S>);
unsafe impl<S: Schedule> Send for Notified<S> {}
unsafe impl<S: Schedule> Sync for Notified<S> {}
/// Task result sent back
pub(crate) type Result<T> ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e7d74b3119178b9b86f7b547774b6b121de2239a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:3 | cfg_rt! {
/// Create a new task with an associated join handle
pub(crate) fn joinable<T, S>(task: T) -> (Notified<S>, JoinHandle<T::Output>)
where
T: Future + Send + 'static,
S: Schedule,
{
let raw = RawTask::new::<_, S>(task);
let task = Task {
raw,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e7d74b3119178b9b86f7b547774b6b121de2239a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | impl<S: 'static> Task<S> {
pub(crate) unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
pub(crate) fn header(&self) -> &Header {
self.raw.header()
}
}
cfg_rt_multi_thread! {
impl<S: 'static... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e7d74b3119178b9b86f7b547774b6b121de2239a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | impl<S: Schedule> Task<S> {
/// Pre-emptively cancel the task as part of the shutdown process.
pub(crate) fn shutdown(&self) {
self.raw.shutdown();
}
}
impl<S: Schedule> Notified<S> {
/// Run the task
pub(crate) fn run(self) {
self.0.raw.poll();
mem::forget(self);
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e7d74b3119178b9b86f7b547774b6b121de2239a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | }
/// # Safety
///
/// Tasks are pinned
unsafe impl<S> linked_list::Link for Task<S> {
type Handle = Task<S>;
type Target = Header;
fn as_raw(handle: &Task<S>) -> NonNull<Header> {
handle.header().into()
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::from_raw(ptr)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | e7d74b3119178b9b86f7b547774b6b121de2239a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/mod.rs | 201 | 222 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:1 | mod core;
use self::core::Cell;
pub(crate) use self::core::Header;
mod error;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::error::JoinError;
mod harness;
use self::harness::Harness;
mod join;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c90681bd8e629b5fde988b9f5be7b915e5cf8ae5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c90681bd8e629b5fde988b9f5be7b915e5cf8ae5/tokio/src/runtime/task/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:1 | mod core;
use self::core::Cell;
pub(crate) use self::core::Header;
mod error;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::error::JoinError;
mod harness;
use self::harness::Harness;
mod join;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/task/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:2 | }
unsafe impl<S> Send for Task<S> {}
unsafe impl<S> Sync for Task<S> {}
/// A task was notified
#[repr(transparent)]
pub(crate) struct Notified<S: 'static>(Task<S>);
unsafe impl<S: Schedule> Send for Notified<S> {}
unsafe impl<S: Schedule> Sync for Notified<S> {}
/// Task result sent back
pub(crate) type Result<T> ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/task/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:3 | cfg_rt_core! {
/// Create a new task with an associated join handle
pub(crate) fn joinable<T, S>(task: T) -> (Notified<S>, JoinHandle<T::Output>)
where
T: Future + Send + 'static,
S: Schedule,
{
let raw = RawTask::new::<_, S>(task);
let task = Task {
raw,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/task/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | impl<S: 'static> Task<S> {
pub(crate) unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
pub(crate) fn header(&self) -> &Header {
self.raw.header()
}
}
cfg_rt_threaded! {
impl<S: 'static> No... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:2 | }
unsafe impl<S> Send for Task<S> {}
unsafe impl<S> Sync for Task<S> {}
/// A task was notified
#[repr(transparent)]
pub(crate) struct Notified<S: 'static>(Task<S>);
unsafe impl<S: Schedule> Send for Notified<S> {}
unsafe impl<S: Schedule> Sync for Notified<S> {}
/// Task result sent back
pub(crate) type Result<T> ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1cb1e291c10adf6b4e530cb1475b95ba10fa615f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cb1e291c10adf6b4e530cb1475b95ba10fa615f/tokio/src/runtime/task/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:3 | /// Create a new task with an associated join handle
pub(crate) fn joinable<T, S>(task: T) -> (Notified<S>, JoinHandle<T::Output>)
where
T: Future + Send + 'static,
S: Schedule,
{
let raw = RawTask::new::<_, S>(task);
let task = Task {
raw,
_p: PhantomData,
};
let join = JoinHa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1cb1e291c10adf6b4e530cb1475b95ba10fa615f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cb1e291c10adf6b4e530cb1475b95ba10fa615f/tokio/src/runtime/task/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | pub(crate) unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
pub(crate) fn header(&self) -> &Header {
self.raw.header()
}
}
cfg_rt_threaded! {
impl<S: 'static> Notified<S> {
pub(crate) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1cb1e291c10adf6b4e530cb1475b95ba10fa615f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cb1e291c10adf6b4e530cb1475b95ba10fa615f/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | pub(crate) fn shutdown(&self) {
self.raw.shutdown();
}
}
impl<S: Schedule> Notified<S> {
/// Run the task
pub(crate) fn run(self) {
self.0.raw.poll();
mem::forget(self);
}
/// Pre-emptively cancel the task as part of the shutdown process.
pub(crate) fn shutdown(self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | a78b1c65ccfb9692ca5d3ed8ddde934f40091d83 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/task/mod.rs | 161 | 219 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | /// # Safety
///
/// Tasks are pinned
unsafe impl<S> linked_list::Link for Task<S> {
type Handle = Task<S>;
type Target = Header;
fn as_raw(handle: &Task<S>) -> NonNull<Header> {
handle.header().into()
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::from_raw(ptr)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | a78b1c65ccfb9692ca5d3ed8ddde934f40091d83 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/task/mod.rs | 201 | 219 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1 | // It doesn't make sense to enforce `unsafe_op_in_unsafe_fn` for this module because
//
// * This module is doing the low-level task management that requires tons of unsafe
// operations.
// * Excessive `unsafe {}` blocks hurt readability significantly.
// TODO: replace with `#[expect(unsafe_op_in_unsafe_fn)]` after ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/raw.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2 | pub(super) drop_abort_handle: unsafe fn(NonNull<Header>),
/// Scheduler is being shutdown.
pub(super) shutdown: unsafe fn(NonNull<Header>),
/// The number of bytes that the `trailer` field is offset from the header.
pub(super) trailer_offset: usize,
/// The number of bytes that the `scheduler` fi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/raw.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:3 | /// See this thread for more info:
/// <https://users.rust-lang.org/t/custom-vtables-with-integers/78508>
struct OffsetHelper<T, S>(T, S);
impl<T: Future, S: Schedule> OffsetHelper<T, S> {
// Pass `size_of`/`align_of` as arguments rather than calling them directly
// inside `get_trailer_offset` because trait bo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/raw.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:4 | /// `#[repr(C)]` algorithm.
///
/// Pseudo-code for the `#[repr(C)]` algorithm can be found here:
/// <https://doc.rust-lang.org/reference/type-layout.html#reprc-structs>
const fn get_trailer_offset(
header_size: usize,
core_size: usize,
core_align: usize,
trailer_align: usize,
) -> usize {
let mut ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/raw.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:5 | }
/// Compute the offset of the `Id` field in `Cell<T, S>` using the
/// `#[repr(C)]` algorithm.
///
/// Pseudo-code for the `#[repr(C)]` algorithm can be found here:
/// <https://doc.rust-lang.org/reference/type-layout.html#reprc-structs>
const fn get_id_offset(
header_size: usize,
core_align: usize,
sche... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/raw.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:6 | let spawn_location_misalign = offset % spawn_location_align;
if spawn_location_misalign > 0 {
offset += spawn_location_align - spawn_location_misalign;
}
offset
}
impl RawTask {
pub(super) fn new<T, S>(
task: T,
scheduler: S,
id: Id,
_spawned_at: super::SpawnLoc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/raw.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:7 | pub(super) fn header_ptr(&self) -> NonNull<Header> {
self.ptr
}
#[cfg(all(
tokio_unstable,
feature = "taskdump",
feature = "rt",
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(super) fn header_ptr_re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/raw.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:8 | pub(super) fn schedule(self) {
let vtable = self.header().vtable;
unsafe { (vtable.schedule)(self.ptr) }
}
pub(super) fn dealloc(self) {
let vtable = self.header().vtable;
unsafe {
(vtable.dealloc)(self.ptr);
}
}
/// Safety: `dst` must be a `*mut Pol... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/raw.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:9 | /// Get the queue-next pointer
///
/// This is for usage by the injection queue
///
/// Safety: make sure only one queue uses this and access is synchronized.
pub(crate) unsafe fn get_queue_next(self) -> Option<RawTask> {
self.header()
.queue_next
.with(|ptr| *ptr)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/raw.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:10 | let harness = Harness::<T, S>::from_raw(ptr);
harness.dealloc();
}
unsafe fn try_read_output<T: Future, S: Schedule>(
ptr: NonNull<Header>,
dst: *mut (),
waker: &Waker,
) {
let out = &mut *(dst as *mut Poll<super::Result<T::Output>>);
let harness = Harness::<T, S>::from_raw(ptr);
harness.t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/raw.rs | 361 | 389 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:6 | let spawn_location_misalign = offset % spawn_location_align;
if spawn_location_misalign > 0 {
offset += spawn_location_align - spawn_location_misalign;
}
offset
}
impl RawTask {
pub(super) fn new<T, S>(
task: T,
scheduler: S,
id: Id,
_spawned_at: super::SpawnLoc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6d3feb581f2620ee4884f9699f5492f079ed0911 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3feb581f2620ee4884f9699f5492f079ed0911/tokio/src/runtime/task/raw.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:7 | pub(super) fn header_ptr(&self) -> NonNull<Header> {
self.ptr
}
pub(super) fn trailer_ptr(&self) -> NonNull<Trailer> {
unsafe { Header::get_trailer(self.ptr) }
}
/// Returns a reference to the task's header.
pub(super) fn header(&self) -> &Header {
unsafe { self.ptr.as_ref(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6d3feb581f2620ee4884f9699f5492f079ed0911 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3feb581f2620ee4884f9699f5492f079ed0911/tokio/src/runtime/task/raw.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:8 | /// Safety: `dst` must be a `*mut Poll<super::Result<T::Output>>` where `T`
/// is the future stored by the task.
pub(super) unsafe fn try_read_output<O>(self, dst: *mut Poll<super::Result<O>>, waker: &Waker) {
let vtable = self.header().vtable;
(vtable.try_read_output)(self.ptr, dst as *mut _, ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6d3feb581f2620ee4884f9699f5492f079ed0911 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3feb581f2620ee4884f9699f5492f079ed0911/tokio/src/runtime/task/raw.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:9 | }
/// Sets the queue-next pointer
///
/// This is for usage by the injection queue
///
/// Safety: make sure only one queue uses this and access is synchronized.
pub(crate) unsafe fn set_queue_next(self, val: Option<RawTask>) {
self.header().set_next(val.map(|task| task.ptr));
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6d3feb581f2620ee4884f9699f5492f079ed0911 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3feb581f2620ee4884f9699f5492f079ed0911/tokio/src/runtime/task/raw.rs | 321 | 378 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:10 | let harness = Harness::<T, S>::from_raw(ptr);
harness.try_read_output(out, waker);
}
unsafe fn drop_join_handle_slow<T: Future, S: Schedule>(ptr: NonNull<Header>) {
let harness = Harness::<T, S>::from_raw(ptr);
harness.drop_join_handle_slow();
}
unsafe fn drop_abort_handle<T: Future, S: Schedule>(ptr: Non... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6d3feb581f2620ee4884f9699f5492f079ed0911 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3feb581f2620ee4884f9699f5492f079ed0911/tokio/src/runtime/task/raw.rs | 361 | 378 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:7 | pub(super) fn header_ptr(&self) -> NonNull<Header> {
self.ptr
}
pub(super) fn trailer_ptr(&self) -> NonNull<Trailer> {
unsafe { Header::get_trailer(self.ptr) }
}
/// Returns a reference to the task's header.
pub(super) fn header(&self) -> &Header {
unsafe { self.ptr.as_ref(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/raw.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:8 | /// Safety: `dst` must be a `*mut Poll<super::Result<T::Output>>` where `T`
/// is the future stored by the task.
pub(super) unsafe fn try_read_output(self, dst: *mut (), waker: &Waker) {
let vtable = self.header().vtable;
(vtable.try_read_output)(self.ptr, dst, waker);
}
pub(super) fn ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/raw.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1 | use crate::future::Future;
use crate::runtime::task::core::{Core, Trailer};
use crate::runtime::task::{Cell, Harness, Header, Id, Schedule, State};
#[cfg(tokio_unstable)]
use std::panic::Location;
use std::ptr::NonNull;
use std::task::{Poll, Waker};
/// Raw task handle
#[derive(Clone)]
pub(crate) struct RawTask {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/raw.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2 | pub(super) scheduler_offset: usize,
/// The number of bytes that the `id` field is offset from the header.
pub(super) id_offset: usize,
/// The number of bytes that the `spawned_at` field is offset from the header.
#[cfg(tokio_unstable)]
pub(super) spawn_location_offset: usize,
}
/// Get the vtab... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/raw.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:3 | std::mem::size_of::<Core<T, S>>(),
std::mem::align_of::<Core<T, S>>(),
std::mem::align_of::<Trailer>(),
);
// The `scheduler` is the first field of `Core`, so it has the same
// offset as `Core`.
const SCHEDULER_OFFSET: usize = get_core_offset(
std::mem::size_of::<Header>(),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/raw.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:4 | ) -> usize {
let mut offset = header_size;
let core_misalign = offset % core_align;
if core_misalign > 0 {
offset += core_align - core_misalign;
}
offset += core_size;
let trailer_misalign = offset % trailer_align;
if trailer_misalign > 0 {
offset += trailer_align - trailer... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/raw.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:5 | core_align: usize,
scheduler_size: usize,
id_align: usize,
) -> usize {
let mut offset = get_core_offset(header_size, core_align);
offset += scheduler_size;
let id_misalign = offset % id_align;
if id_misalign > 0 {
offset += id_align - id_misalign;
}
offset
}
/// Compute the o... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/raw.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:6 | impl RawTask {
pub(super) fn new<T, S>(
task: T,
scheduler: S,
id: Id,
_spawned_at: super::SpawnLocation,
) -> RawTask
where
T: Future,
S: Schedule,
{
let ptr = Box::into_raw(Cell::<_, S>::new(
task,
scheduler,
S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/raw.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:7 | /// Returns a reference to the task's trailer.
pub(super) fn trailer(&self) -> &Trailer {
unsafe { &*self.trailer_ptr().as_ptr() }
}
/// Returns a reference to the task's state.
pub(super) fn state(&self) -> &State {
&self.header().state
}
/// Safety: mutual exclusion is requir... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/raw.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:8 | pub(super) fn drop_abort_handle(self) {
let vtable = self.header().vtable;
unsafe { (vtable.drop_abort_handle)(self.ptr) }
}
pub(super) fn shutdown(self) {
let vtable = self.header().vtable;
unsafe { (vtable.shutdown)(self.ptr) }
}
/// Increment the task's reference cou... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/raw.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:9 | impl Copy for RawTask {}
unsafe fn poll<T: Future, S: Schedule>(ptr: NonNull<Header>) {
let harness = Harness::<T, S>::from_raw(ptr);
harness.poll();
}
unsafe fn schedule<S: Schedule>(ptr: NonNull<Header>) {
use crate::runtime::task::{Notified, Task};
let scheduler = Header::get_scheduler::<S>(ptr);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/raw.rs | 321 | 366 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1 | use crate::future::Future;
use crate::runtime::task::core::{Core, Trailer};
use crate::runtime::task::{Cell, Harness, Header, Id, Schedule, State};
use std::ptr::NonNull;
use std::task::{Poll, Waker};
/// Raw task handle
#[derive(Clone)]
pub(crate) struct RawTask {
ptr: NonNull<Header>,
}
pub(super) struct Vtabl... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/raw.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2 | /// The number of bytes that the `id` field is offset from the header.
pub(super) id_offset: usize,
}
/// Get the vtable for the requested `T` and `S` generics.
pub(super) fn vtable<T: Future, S: Schedule>() -> &'static Vtable {
&Vtable {
poll: poll::<T, S>,
schedule: schedule::<S>,
dea... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/raw.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:3 | const SCHEDULER_OFFSET: usize = get_core_offset(
std::mem::size_of::<Header>(),
std::mem::align_of::<Core<T, S>>(),
);
const ID_OFFSET: usize = get_id_offset(
std::mem::size_of::<Header>(),
std::mem::align_of::<Core<T, S>>(),
std::mem::size_of::<S>(),
std::mem::a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/raw.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:4 | /// Compute the offset of the `Core<T, S>` field in `Cell<T, S>` using the
/// `#[repr(C)]` algorithm.
///
/// Pseudo-code for the `#[repr(C)]` algorithm can be found here:
/// <https://doc.rust-lang.org/reference/type-layout.html#reprc-structs>
const fn get_core_offset(header_size: usize, core_align: usize) -> usize {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/raw.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:5 | where
T: Future,
S: Schedule,
{
let ptr = Box::into_raw(Cell::<_, S>::new(task, scheduler, State::new(), id));
let ptr = unsafe { NonNull::new_unchecked(ptr.cast()) };
RawTask { ptr }
}
pub(super) unsafe fn from_raw(ptr: NonNull<Header>) -> RawTask {
RawTask... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/raw.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:6 | unsafe { (vtable.poll)(self.ptr) }
}
pub(super) fn schedule(self) {
let vtable = self.header().vtable;
unsafe { (vtable.schedule)(self.ptr) }
}
pub(super) fn dealloc(self) {
let vtable = self.header().vtable;
unsafe {
(vtable.dealloc)(self.ptr);
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/raw.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:7 | pub(super) fn ref_inc(self) {
self.header().state.ref_inc();
}
/// Get the queue-next pointer
///
/// This is for usage by the injection queue
///
/// Safety: make sure only one queue uses this and access is synchronized.
pub(crate) unsafe fn get_queue_next(self) -> Option<RawTask> ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/raw.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:8 | }
unsafe fn dealloc<T: Future, S: Schedule>(ptr: NonNull<Header>) {
let harness = Harness::<T, S>::from_raw(ptr);
harness.dealloc();
}
unsafe fn try_read_output<T: Future, S: Schedule>(
ptr: NonNull<Header>,
dst: *mut (),
waker: &Waker,
) {
let out = &mut *(dst as *mut Poll<super::Result<T::Ou... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/raw.rs | 281 | 312 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1 | use crate::future::Future;
use crate::runtime::task::core::{Core, Trailer};
use crate::runtime::task::{Cell, Harness, Header, Id, Schedule, State};
use std::ptr::NonNull;
use std::task::{Poll, Waker};
/// Raw task handle
pub(crate) struct RawTask {
ptr: NonNull<Header>,
}
pub(super) struct Vtable {
/// Polls... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/task/raw.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2 | /// The number of bytes that the `id` field is offset from the header.
pub(super) id_offset: usize,
}
/// Get the vtable for the requested `T` and `S` generics.
pub(super) fn vtable<T: Future, S: Schedule>() -> &'static Vtable {
&Vtable {
poll: poll::<T, S>,
schedule: schedule::<S>,
dea... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/task/raw.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:3 | std::mem::size_of::<Header>(),
std::mem::align_of::<Core<T, S>>(),
);
const ID_OFFSET: usize = get_id_offset(
std::mem::size_of::<Header>(),
std::mem::align_of::<Core<T, S>>(),
std::mem::size_of::<S>(),
std::mem::align_of::<Id>(),
);
}
/// Compute the offset of the ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/task/raw.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:4 | /// `#[repr(C)]` algorithm.
///
/// Pseudo-code for the `#[repr(C)]` algorithm can be found here:
/// <https://doc.rust-lang.org/reference/type-layout.html#reprc-structs>
const fn get_core_offset(header_size: usize, core_align: usize) -> usize {
let mut offset = header_size;
let core_misalign = offset % core_a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/task/raw.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:5 | T: Future,
S: Schedule,
{
let ptr = Box::into_raw(Cell::<_, S>::new(task, scheduler, State::new(), id));
let ptr = unsafe { NonNull::new_unchecked(ptr as *mut Header) };
RawTask { ptr }
}
pub(super) unsafe fn from_raw(ptr: NonNull<Header>) -> RawTask {
RawTask { ptr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/task/raw.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:6 | }
pub(super) fn schedule(self) {
let vtable = self.header().vtable;
unsafe { (vtable.schedule)(self.ptr) }
}
pub(super) fn dealloc(self) {
let vtable = self.header().vtable;
unsafe {
(vtable.dealloc)(self.ptr);
}
}
/// Safety: `dst` must be a `*... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/task/raw.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:7 | self.header().state.ref_inc();
}
/// Get the queue-next pointer
///
/// This is for usage by the injection queue
///
/// Safety: make sure only one queue uses this and access is synchronized.
pub(crate) unsafe fn get_queue_next(self) -> Option<RawTask> {
self.header()
.q... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/task/raw.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:8 | let scheduler = Header::get_scheduler::<S>(ptr);
scheduler
.as_ref()
.schedule(Notified(Task::from_raw(ptr.cast())));
}
unsafe fn dealloc<T: Future, S: Schedule>(ptr: NonNull<Header>) {
let harness = Harness::<T, S>::from_raw(ptr);
harness.dealloc();
}
unsafe fn try_read_output<T: Future, ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/task/raw.rs | 281 | 317 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1 | use crate::future::Future;
use crate::runtime::task::core::{Core, Trailer};
use crate::runtime::task::{Cell, Harness, Header, Id, Schedule, State};
use std::ptr::NonNull;
use std::task::{Poll, Waker};
/// Raw task handle
pub(in crate::runtime) struct RawTask {
ptr: NonNull<Header>,
}
pub(super) struct Vtable {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/raw.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:6 | }
pub(super) fn schedule(self) {
let vtable = self.header().vtable;
unsafe { (vtable.schedule)(self.ptr) }
}
pub(super) fn dealloc(self) {
let vtable = self.header().vtable;
unsafe {
(vtable.dealloc)(self.ptr);
}
}
/// Safety: `dst` must be a `*... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/raw.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:7 | self.header().state.ref_inc();
}
}
impl Clone for RawTask {
fn clone(&self) -> Self {
RawTask { ptr: self.ptr }
}
}
impl Copy for RawTask {}
unsafe fn poll<T: Future, S: Schedule>(ptr: NonNull<Header>) {
let harness = Harness::<T, S>::from_raw(ptr);
harness.poll();
}
unsafe fn schedule<S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/raw.rs | 241 | 296 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:8 | }
unsafe fn drop_join_handle_slow<T: Future, S: Schedule>(ptr: NonNull<Header>) {
let harness = Harness::<T, S>::from_raw(ptr);
harness.drop_join_handle_slow()
}
unsafe fn drop_abort_handle<T: Future, S: Schedule>(ptr: NonNull<Header>) {
let harness = Harness::<T, S>::from_raw(ptr);
harness.drop_refer... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/raw.rs | 281 | 296 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1 | use crate::future::Future;
use crate::runtime::task::core::{Core, Trailer};
use crate::runtime::task::{Cell, Harness, Header, Id, Schedule, State};
use std::ptr::NonNull;
use std::task::{Poll, Waker};
/// Raw task handle
pub(super) struct RawTask {
ptr: NonNull<Header>,
}
pub(super) struct Vtable {
/// Polls... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/raw.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:5 | T: Future,
S: Schedule,
{
let ptr = Box::into_raw(Cell::<_, S>::new(task, scheduler, State::new(), id));
let ptr = unsafe { NonNull::new_unchecked(ptr as *mut Header) };
RawTask { ptr }
}
pub(super) unsafe fn from_raw(ptr: NonNull<Header>) -> RawTask {
RawTask { ptr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/raw.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1 | use crate::future::Future;
use crate::runtime::task::core::{Core, Trailer};
use crate::runtime::task::{Cell, Harness, Header, Id, Schedule, State};
use std::ptr::NonNull;
use std::task::{Poll, Waker};
/// Raw task handle
pub(super) struct RawTask {
ptr: NonNull<Header>,
}
pub(super) struct Vtable {
/// Polls... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 228d4fce992124fc646a2e49606a65847166413c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/raw.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2 | pub(super) trailer_offset: usize,
}
/// Get the vtable for the requested `T` and `S` generics.
pub(super) fn vtable<T: Future, S: Schedule>() -> &'static Vtable {
&Vtable {
poll: poll::<T, S>,
dealloc: dealloc::<T, S>,
try_read_output: try_read_output::<T, S>,
try_set_join_waker: tr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 228d4fce992124fc646a2e49606a65847166413c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/raw.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:3 | /// <https://doc.rust-lang.org/reference/type-layout.html#reprc-structs>
const fn get_trailer_offset(
header_size: usize,
core_size: usize,
core_align: usize,
trailer_align: usize,
) -> usize {
let mut offset = header_size;
let core_misalign = offset % core_align;
if core_misalign > 0 {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 228d4fce992124fc646a2e49606a65847166413c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/raw.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:4 | self.ptr
}
/// Returns a reference to the task's meta structure.
///
/// Safe as `Header` is `Sync`.
pub(super) fn header(&self) -> &Header {
unsafe { self.ptr.as_ref() }
}
/// Safety: mutual exclusion is required to call this function.
pub(super) fn poll(self) {
let vt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 228d4fce992124fc646a2e49606a65847166413c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/raw.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:5 | pub(super) fn drop_abort_handle(self) {
let vtable = self.header().vtable;
unsafe { (vtable.drop_abort_handle)(self.ptr) }
}
pub(super) fn shutdown(self) {
let vtable = self.header().vtable;
unsafe { (vtable.shutdown)(self.ptr) }
}
pub(super) fn remote_abort(self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 228d4fce992124fc646a2e49606a65847166413c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/raw.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:6 | unsafe fn try_read_output<T: Future, S: Schedule>(
ptr: NonNull<Header>,
dst: *mut (),
waker: &Waker,
) {
let out = &mut *(dst as *mut Poll<super::Result<T::Output>>);
let harness = Harness::<T, S>::from_raw(ptr);
harness.try_read_output(out, waker);
}
unsafe fn try_set_join_waker<T: Future, S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 228d4fce992124fc646a2e49606a65847166413c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/raw.rs | 201 | 236 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1 | use crate::future::Future;
use crate::runtime::task::{Cell, Harness, Header, Id, Schedule, State};
use std::ptr::NonNull;
use std::task::{Poll, Waker};
/// Raw task handle
pub(super) struct RawTask {
ptr: NonNull<Header>,
}
pub(super) struct Vtable {
/// Polls the future.
pub(super) poll: unsafe fn(NonNu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/raw.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2 | pub(super) fn vtable<T: Future, S: Schedule>() -> &'static Vtable {
&Vtable {
poll: poll::<T, S>,
dealloc: dealloc::<T, S>,
try_read_output: try_read_output::<T, S>,
try_set_join_waker: try_set_join_waker::<T, S>,
drop_join_handle_slow: drop_join_handle_slow::<T, S>,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/raw.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:3 | /// Safety: mutual exclusion is required to call this function.
pub(super) fn poll(self) {
let vtable = self.header().vtable;
unsafe { (vtable.poll)(self.ptr) }
}
pub(super) fn dealloc(self) {
let vtable = self.header().vtable;
unsafe {
(vtable.dealloc)(self.ptr)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/raw.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:4 | pub(super) fn remote_abort(self) {
let vtable = self.header().vtable;
unsafe { (vtable.remote_abort)(self.ptr) }
}
/// Increment the task's reference count.
///
/// Currently, this is used only when creating an `AbortHandle`.
pub(super) fn ref_inc(self) {
self.header().state... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/raw.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:5 | }
unsafe fn try_set_join_waker<T: Future, S: Schedule>(ptr: NonNull<Header>, waker: &Waker) -> bool {
let harness = Harness::<T, S>::from_raw(ptr);
harness.try_set_join_waker(waker)
}
unsafe fn drop_join_handle_slow<T: Future, S: Schedule>(ptr: NonNull<Header>) {
let harness = Harness::<T, S>::from_raw(pt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/raw.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/raw.rs | 161 | 186 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.