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:6 | mod join;
#[cfg(feature = "rt")]
pub use self::abort::AbortHandle;
pub use self::join::JoinHandle;
mod list;
pub(crate) use self::list::{LocalOwnedTasks, OwnedTasks};
mod raw;
pub(crate) use self::raw::RawTask;
mod state;
use self::state::State;
mod waker;
cfg_taskdump! {
pub(crate) mod trace;
}
use crate::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | /// 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 verifying
// that the value is on a thread where it is safe to poll the task.
unsafe impl<S: Schedule> Send for Notified<S> {}
unsafe impl<S: Schedule> Sync... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | #[derive(Clone)]
pub(crate) struct TaskHarnessScheduleHooks {
pub(crate) task_terminate_callback: Option<TaskCallback>,
}
pub(crate) trait Schedule: Sync + Sized + 'static {
/// The task has completed work and is ready to be released. The scheduler
/// should release it immediately and return it. The task ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | where
S: Schedule,
T: Future + 'static,
T::Output: 'static,
{
let raw = RawTask::new::<T, S>(task, scheduler, id);
let task = Task {
raw,
_p: PhantomData,
};
let notified = Notified(Task {
raw,
_p: PhantomData,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | (unowned, join)
}
}
impl<S: 'static> Task<S> {
unsafe fn new(raw: RawTask) -> Task<S> {
Task {
raw,
_p: PhantomData,
}
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::new(RawTask::from_raw(ptr))
}
#[cfg(all(
tokio_unstable,... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | pub(crate) fn id(&self) -> crate::task::Id {
// Safety: The header pointer is valid.
unsafe { Header::get_id(self.raw.header_ptr()) }
}
cfg_taskdump! {
/// Notify the task for task dumping.
///
/// Returns `None` if the task has already been notified.
pub(super) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | impl<S: 'static> Notified<S> {
pub(crate) fn into_raw(self) -> RawTask {
let raw = self.0.raw;
mem::forget(self);
raw
}
}
impl<S: Schedule> Task<S> {
/// Preemptively cancels the task as part of the shutdown process.
pub(crate) fn shutdown(self) {
let raw = self.raw;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | mem::forget(self);
// Drop a ref-count since an UnownedTask holds two.
task.header().state.ref_dec();
task
}
pub(crate) fn run(self) {
let raw = self.raw;
mem::forget(self);
// Transfer one ref-count to a Task object.
let task = Task::<S> {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | 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(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task/mod.rs | 521 | 573 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:15 | /// # Safety
///
/// The id of a task is never changed after creation of the task, so the return value of
/// `get_shard_id` will not change. (The cast may throw away the upper 32 bits of the task id, but
/// the shard id still won't change from call to call.)
unsafe impl<S> sharded_list::ShardedListItem for Task<S> {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task/mod.rs | 561 | 573 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | mod join;
#[cfg(feature = "rt")]
pub use self::abort::AbortHandle;
pub use self::join::JoinHandle;
mod list;
pub(crate) use self::list::{LocalOwnedTasks, OwnedTasks};
mod raw;
pub(crate) use self::raw::RawTask;
mod state;
use self::state::State;
mod waker;
cfg_taskdump! {
pub(crate) mod trace;
}
use crate::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 970d880ceb473b222a9ddd4b35b934ca68cecb4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | /// 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 verifying
// that the value is on a thread where it is safe to poll the task.
unsafe impl<S: Schedule> Send for Notified<S> {}
unsafe impl<S: Schedule> Sync... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 970d880ceb473b222a9ddd4b35b934ca68cecb4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | /// 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: &Task<Self>) -> Option<Task<Self>>;
/// Schedule the task
fn schedule(&s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 970d880ceb473b222a9ddd4b35b934ca68cecb4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | raw,
_p: PhantomData,
};
let notified = Notified(Task {
raw,
_p: PhantomData,
});
let join = JoinHandle::new(raw);
(task, notified, join)
}
/// Creates a new task with an associated join handle. This method is used
/// only when t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 970d880ceb473b222a9ddd4b35b934ca68cecb4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | raw,
_p: PhantomData,
}
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::new(RawTask::from_raw(ptr))
}
#[cfg(all(
tokio_unstable,
tokio_taskdump,
feature = "rt",
target_os = "linux",
any(target_arch = "aarch64", target_ar... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 970d880ceb473b222a9ddd4b35b934ca68cecb4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | }
/// Returns a [task ID] that uniquely identifies this task relative to other
/// currently spawned tasks.
///
/// [task ID]: crate::task::Id
#[cfg(tokio_unstable)]
pub(crate) fn id(&self) -> crate::task::Id {
// Safety: The header pointer is valid.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 970d880ceb473b222a9ddd4b35b934ca68cecb4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | }
}
impl<S: Schedule> LocalNotified<S> {
/// Runs the task.
pub(crate) fn run(self) {
let raw = self.task.raw;
mem::forget(self);
raw.poll();
}
}
impl<S: Schedule> UnownedTask<S> {
// Used in test of the inject queue.
#[cfg(test)]
#[cfg_attr(target_family = "wasm", allo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 970d880ceb473b222a9ddd4b35b934ca68cecb4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | raw,
_p: PhantomData,
};
// Use the other ref-count to poll the task.
raw.poll();
// Decrement our extra ref-count
drop(task);
}
pub(crate) fn shutdown(self) {
self.into_task().shutdown();
}
}
impl<S: 'static> Drop for Task<S> {
fn drop(&mut... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 970d880ceb473b222a9ddd4b35b934ca68cecb4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | impl<S> fmt::Debug for Notified<S> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "task::Notified({:p})", self.0.header())
}
}
/// # Safety
///
/// Tasks are pinned.
unsafe impl<S> linked_list::Link for Task<S> {
type Handle = Task<S>;
type Target = Header;
fn a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 970d880ceb473b222a9ddd4b35b934ca68cecb4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/mod.rs | 521 | 559 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! the API exposed by the task module, so this has to be safe. In either case,
//! the lock in the RUNNING bitfield makes the inner call return immediately. If
//! the inner call is a `shutdown` call, then the CANCELLED bit is set, and the
//! poll call will notice it when the poll finishes, and the task is cancelled
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 92ccadeb3c7058cdc8799b998f6a19a1171691df | github | async-runtime | https://github.com/tokio-rs/tokio/blob/92ccadeb3c7058cdc8799b998f6a19a1171691df/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | use self::state::State;
mod waker;
cfg_taskdump! {
pub(crate) mod trace;
}
use crate::future::Future;
use crate::util::linked_list;
use crate::util::sharded_list;
use crate::runtime::TaskCallback;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::{fmt, mem};
/// An owned handle to the task, tracked... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 92ccadeb3c7058cdc8799b998f6a19a1171691df | github | async-runtime | https://github.com/tokio-rs/tokio/blob/92ccadeb3c7058cdc8799b998f6a19a1171691df/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | task: Task<S>,
_not_send: PhantomData<*const ()>,
}
/// A task that is not owned by any `OwnedTasks`. Used for blocking tasks.
/// This type holds two ref-counts.
pub(crate) struct UnownedTask<S: 'static> {
raw: RawTask,
_p: PhantomData<S>,
}
// safety: This type can only be created given a Send task.
uns... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 92ccadeb3c7058cdc8799b998f6a19a1171691df | github | async-runtime | https://github.com/tokio-rs/tokio/blob/92ccadeb3c7058cdc8799b998f6a19a1171691df/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | self.schedule(task);
}
/// Polling the task resulted in a panic. Should the runtime shutdown?
fn unhandled_panic(&self) {
// By default, do nothing. This maintains the 1.0 behavior.
}
}
cfg_rt! {
/// This is the constructor for a new task. Three references to the task are
/// created. ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 92ccadeb3c7058cdc8799b998f6a19a1171691df | github | async-runtime | https://github.com/tokio-rs/tokio/blob/92ccadeb3c7058cdc8799b998f6a19a1171691df/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | ///
/// Currently only blocking tasks use this method.
pub(crate) fn unowned<T, S>(task: T, scheduler: S, id: Id) -> (UnownedTask<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Send + Future + 'static,
T::Output: Send + 'static,
{
let (task, notified, join) = new_task(t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 92ccadeb3c7058cdc8799b998f6a19a1171691df | github | async-runtime | https://github.com/tokio-rs/tokio/blob/92ccadeb3c7058cdc8799b998f6a19a1171691df/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(super) fn as_raw(&self) -> RawTask {
self.raw
}
fn header(&self) -> &Header {
self.raw.header()
}
fn header_ptr(&self) -> NonNull<Header> {
self.raw.header_ptr()
}
cfg_taskdump! {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 92ccadeb3c7058cdc8799b998f6a19a1171691df | github | async-runtime | https://github.com/tokio-rs/tokio/blob/92ccadeb3c7058cdc8799b998f6a19a1171691df/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | impl<S: 'static> Notified<S> {
fn header(&self) -> &Header {
self.0.header()
}
}
impl<S: 'static> Notified<S> {
pub(crate) unsafe fn from_raw(ptr: RawTask) -> Notified<S> {
Notified(Task::new(ptr))
}
}
impl<S: 'static> Notified<S> {
pub(crate) fn into_raw(self) -> RawTask {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 92ccadeb3c7058cdc8799b998f6a19a1171691df | github | async-runtime | https://github.com/tokio-rs/tokio/blob/92ccadeb3c7058cdc8799b998f6a19a1171691df/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | impl<S: 'static> Drop for Task<S> {
fn drop(&mut self) {
// Decrement the ref count
if self.header().state.ref_dec() {
// Deallocate if this is the final ref count
self.raw.dealloc();
}
}
}
impl<S: 'static> Drop for UnownedTask<S> {
fn drop(&mut self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 92ccadeb3c7058cdc8799b998f6a19a1171691df | github | async-runtime | https://github.com/tokio-rs/tokio/blob/92ccadeb3c7058cdc8799b998f6a19a1171691df/tokio/src/runtime/task/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | fn as_raw(handle: &Task<S>) -> NonNull<Header> {
handle.raw.header_ptr()
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::from_raw(ptr)
}
unsafe fn pointers(target: NonNull<Header>) -> NonNull<linked_list::Pointers<Header>> {
self::core::Trailer::addr_of_owned(Head... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 92ccadeb3c7058cdc8799b998f6a19a1171691df | github | async-runtime | https://github.com/tokio-rs/tokio/blob/92ccadeb3c7058cdc8799b998f6a19a1171691df/tokio/src/runtime/task/mod.rs | 521 | 545 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(super) fn as_raw(&self) -> RawTask {
self.raw
}
fn header(&self) -> &Header {
self.raw.header()
}
fn header_ptr(&self) -> NonNull<Header> {
self.raw.header_ptr()
}
cfg_taskdump! {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b37f0de28a17ced6a9e6738062770d6fea8c5364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | // Used in test of the inject queue.
#[cfg(test)]
#[cfg_attr(target_family = "wasm", allow(dead_code))]
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: ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b37f0de28a17ced6a9e6738062770d6fea8c5364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | }
impl<S: 'static> Drop for Task<S> {
fn drop(&mut self) {
// Decrement the ref count
if self.header().state.ref_dec() {
// Deallocate if this is the final ref count
self.raw.dealloc();
}
}
}
impl<S: 'static> Drop for UnownedTask<S> {
fn drop(&mut self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b37f0de28a17ced6a9e6738062770d6fea8c5364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! the API exposed by the task module, so this has to be safe. In either case,
//! the lock in the RUNNING bitfield makes the inner call return immediately. If
//! the inner call is a `shutdown` call, then the CANCELLED bit is set, and the
//! poll call will notice it when the poll finishes, and the task is cancelled
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | use self::state::State;
mod waker;
cfg_taskdump! {
pub(crate) mod trace;
}
use crate::future::Future;
use crate::util::linked_list;
use crate::util::sharded_list;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::{fmt, mem};
/// An owned handle to the task, tracked by ref count.
#[repr(transparent)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | _not_send: PhantomData<*const ()>,
}
/// A task that is not owned by any `OwnedTasks`. Used for blocking tasks.
/// This type holds two ref-counts.
pub(crate) struct UnownedTask<S: 'static> {
raw: RawTask,
_p: PhantomData<S>,
}
// safety: This type can only be created given a Send task.
unsafe impl<S> Send fo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | cfg_rt! {
/// This is the constructor for a new task. Three references to the task are
/// created. The first task reference is usually put into an `OwnedTasks`
/// immediately. The Notified is sent to the scheduler as an ordinary
/// notification.
fn new_task<T, S>(
task: T,
schedul... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | // This transfers the ref-count of task and notified into an UnownedTask.
// This is valid because an UnownedTask holds two ref-counts.
let unowned = UnownedTask {
raw: task.raw,
_p: PhantomData,
};
std::mem::forget(task);
std::mem::forget(notified);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | fn header_ptr(&self) -> NonNull<Header> {
self.raw.header_ptr()
}
cfg_taskdump! {
/// Notify the task for task dumping.
///
/// Returns `None` if the task has already been notified.
pub(super) fn notify_for_tracing(&self) -> Option<Notified<S>> {
if self.as_r... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | Notified(Task::new(ptr))
}
}
impl<S: 'static> Notified<S> {
pub(crate) fn into_raw(self) -> RawTask {
let raw = self.0.raw;
mem::forget(self);
raw
}
}
impl<S: Schedule> Task<S> {
/// Preemptively cancels 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 | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | let task = Task {
raw: self.raw,
_p: PhantomData,
};
mem::forget(self);
// Drop a ref-count since an UnownedTask holds two.
task.header().state.ref_dec();
task
}
pub(crate) fn run(self) {
let raw = self.raw;
mem::forget(self);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | }
}
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(&self, ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/mod.rs | 481 | 537 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | unsafe fn pointers(target: NonNull<Header>) -> NonNull<linked_list::Pointers<Header>> {
self::core::Trailer::addr_of_owned(Header::get_trailer(target))
}
}
/// # Safety
///
/// The id of a task is never changed after creation of the task, so the return value of
/// `get_shard_id` will not change. (The cast... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/mod.rs | 521 | 537 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | }
}
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(&self, ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 10c9eeb6c2af85961044b7cbb16a5a2d2e97287d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10c9eeb6c2af85961044b7cbb16a5a2d2e97287d/tokio/src/runtime/task/mod.rs | 481 | 537 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | unsafe fn pointers(target: NonNull<Header>) -> NonNull<linked_list::Pointers<Header>> {
self::core::Trailer::addr_of_owned(Header::get_trailer(target))
}
}
/// # Safety
///
/// The id of a task is never changed after creation of the task, so the return value of
/// `get_shard_id` will not change. (The cast... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 10c9eeb6c2af85961044b7cbb16a5a2d2e97287d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10c9eeb6c2af85961044b7cbb16a5a2d2e97287d/tokio/src/runtime/task/mod.rs | 521 | 537 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | // This transfers the ref-count of task and notified into an UnownedTask.
// This is valid because an UnownedTask holds two ref-counts.
let unowned = UnownedTask {
raw: task.raw,
_p: PhantomData,
};
std::mem::forget(task);
std::mem::forget(notified);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | fn header_ptr(&self) -> NonNull<Header> {
self.raw.header_ptr()
}
cfg_taskdump! {
/// Notify the task for task dumping.
///
/// Returns `None` if the task has already been notified.
pub(super) fn notify_for_tracing(&self) -> Option<Notified<S>> {
if self.as_r... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | impl<S: Schedule> Task<S> {
/// Preemptively cancels the task as part of the shutdown process.
pub(crate) fn shutdown(self) {
let raw = self.raw;
mem::forget(self);
raw.shutdown();
}
}
impl<S: Schedule> LocalNotified<S> {
/// Runs the task.
pub(crate) fn run(self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | pub(crate) fn run(self) {
let raw = self.raw;
mem::forget(self);
// Transfer one ref-count to a Task object.
let task = Task::<S> {
raw,
_p: PhantomData,
};
// Use the other ref-count to poll the task.
raw.poll();
// Decrement our... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | }
impl<S> fmt::Debug for Task<S> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "Task({:p})", self.header())
}
}
impl<S> fmt::Debug for Notified<S> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "task::Notified({:p})", self.0.header()... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/mod.rs | 481 | 526 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | use self::state::State;
mod waker;
cfg_taskdump! {
pub(crate) mod trace;
}
use crate::future::Future;
use crate::util::linked_list;
use crate::util::sharded_list;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::{fmt, mem};
/// An owned handle to the task, tracked by ref count.
#[repr(transparent)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | _not_send: PhantomData<*const ()>,
}
/// A task that is not owned by any OwnedTasks. Used for blocking tasks.
/// This type holds two ref-counts.
pub(crate) struct UnownedTask<S: 'static> {
raw: RawTask,
_p: PhantomData<S>,
}
// safety: This type can only be created given a Send task.
unsafe impl<S> Send for ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | cfg_rt! {
/// This is the constructor for a new task. Three references to the task are
/// created. The first task reference is usually put into an OwnedTasks
/// immediately. The Notified is sent to the scheduler as an ordinary
/// notification.
fn new_task<T, S>(
task: T,
scheduler... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | // This transfers the ref-count of task and notified into an UnownedTask.
// This is valid because an UnownedTask holds two ref-counts.
let unowned = UnownedTask {
raw: task.raw,
_p: PhantomData,
};
std::mem::forget(task);
std::mem::forget(notified);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | fn header_ptr(&self) -> NonNull<Header> {
self.raw.header_ptr()
}
cfg_taskdump! {
pub(super) fn notify_for_tracing(&self) -> Notified<S> {
self.as_raw().state().transition_to_notified_for_tracing();
// SAFETY: `transition_to_notified_for_tracing` increments the refcount.... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | impl<S> fmt::Debug for Notified<S> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "task::Notified({:p})", self.0.header())
}
}
/// # Safety
///
/// Tasks are pinned.
unsafe impl<S> linked_list::Link for Task<S> {
type Handle = Task<S>;
type Target = Header;
fn a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/task/mod.rs | 481 | 519 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! the API exposed by the task module, so this has to be safe. In either case,
//! the lock in the RUNNING bitfield makes the inner call return immediately. If
//! the inner call is a `shutdown` call, then the CANCELLED bit is set, and the
//! poll call will notice it when the poll finishes, and the task is cancelled
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 58acb56a172747e5d9ddaec6bf578330d251ddaa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58acb56a172747e5d9ddaec6bf578330d251ddaa/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | use self::state::State;
mod waker;
cfg_taskdump! {
pub(crate) mod trace;
}
use crate::future::Future;
use crate::util::linked_list;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::{fmt, mem};
/// An owned handle to the task, tracked by ref count.
#[repr(transparent)]
pub(crate) struct Task<S: 'st... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 58acb56a172747e5d9ddaec6bf578330d251ddaa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58acb56a172747e5d9ddaec6bf578330d251ddaa/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | }
/// A task that is not owned by any OwnedTasks. Used for blocking tasks.
/// This type holds two ref-counts.
pub(crate) struct UnownedTask<S: 'static> {
raw: RawTask,
_p: PhantomData<S>,
}
// safety: This type can only be created given a Send task.
unsafe impl<S> Send for UnownedTask<S> {}
unsafe impl<S> Sy... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 58acb56a172747e5d9ddaec6bf578330d251ddaa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58acb56a172747e5d9ddaec6bf578330d251ddaa/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | /// This is the constructor for a new task. Three references to the task are
/// created. The first task reference is usually put into an OwnedTasks
/// immediately. The Notified is sent to the scheduler as an ordinary
/// notification.
fn new_task<T, S>(
task: T,
scheduler: S,
i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 58acb56a172747e5d9ddaec6bf578330d251ddaa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58acb56a172747e5d9ddaec6bf578330d251ddaa/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | // This transfers the ref-count of task and notified into an UnownedTask.
// This is valid because an UnownedTask holds two ref-counts.
let unowned = UnownedTask {
raw: task.raw,
_p: PhantomData,
};
std::mem::forget(task);
std::mem::forget(notified);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 58acb56a172747e5d9ddaec6bf578330d251ddaa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58acb56a172747e5d9ddaec6bf578330d251ddaa/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | fn header_ptr(&self) -> NonNull<Header> {
self.raw.header_ptr()
}
cfg_taskdump! {
pub(super) fn notify_for_tracing(&self) -> Notified<S> {
self.as_raw().state().transition_to_notified_for_tracing();
// SAFETY: `transition_to_notified_for_tracing` increments the refcount.... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 58acb56a172747e5d9ddaec6bf578330d251ddaa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58acb56a172747e5d9ddaec6bf578330d251ddaa/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | }
impl<S: Schedule> LocalNotified<S> {
/// Runs the task.
pub(crate) fn run(self) {
let raw = self.task.raw;
mem::forget(self);
raw.poll();
}
}
impl<S: Schedule> UnownedTask<S> {
// Used in test of the inject queue.
#[cfg(test)]
#[cfg_attr(target_family = "wasm", allow(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 58acb56a172747e5d9ddaec6bf578330d251ddaa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58acb56a172747e5d9ddaec6bf578330d251ddaa/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | _p: PhantomData,
};
// Use the other ref-count to poll the task.
raw.poll();
// Decrement our extra ref-count
drop(task);
}
pub(crate) fn shutdown(self) {
self.into_task().shutdown();
}
}
impl<S: 'static> Drop for Task<S> {
fn drop(&mut self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 58acb56a172747e5d9ddaec6bf578330d251ddaa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58acb56a172747e5d9ddaec6bf578330d251ddaa/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | impl<S> fmt::Debug for Notified<S> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "task::Notified({:p})", self.0.header())
}
}
/// # Safety
///
/// Tasks are pinned.
unsafe impl<S> linked_list::Link for Task<S> {
type Handle = Task<S>;
type Target = Header;
fn a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 58acb56a172747e5d9ddaec6bf578330d251ddaa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58acb56a172747e5d9ddaec6bf578330d251ddaa/tokio/src/runtime/task/mod.rs | 481 | 505 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! the API exposed by the task module, so this has to be safe. In either case,
//! the lock in the RUNNING bitfield makes the inner call return immediately. If
//! the inner call is a `shutdown` call, then the CANCELLED bit is set, and the
//! poll call will notice it when the poll finishes, and the task is cancelled
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | }
impl<S: Schedule> LocalNotified<S> {
/// Runs the task.
pub(crate) fn run(self) {
let raw = self.task.raw;
mem::forget(self);
raw.poll();
}
}
impl<S: Schedule> UnownedTask<S> {
// Used in test of the inject queue.
#[cfg(test)]
#[cfg_attr(target_family = "wasm", allow(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 2bd43765d99e7caaee626f6804ef9f56cc06aefd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2bd43765d99e7caaee626f6804ef9f56cc06aefd/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | _p: PhantomData,
};
// Use the other ref-count to poll the task.
raw.poll();
// Decrement our extra ref-count
drop(task);
}
pub(crate) fn shutdown(self) {
self.into_task().shutdown()
}
}
impl<S: 'static> Drop for Task<S> {
fn drop(&mut self) {
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 2bd43765d99e7caaee626f6804ef9f56cc06aefd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2bd43765d99e7caaee626f6804ef9f56cc06aefd/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | // This transfers the ref-count of task and notified into an UnownedTask.
// This is valid because an UnownedTask holds two ref-counts.
let unowned = UnownedTask {
raw: task.raw,
_p: PhantomData,
};
std::mem::forget(task);
std::mem::forget(notified);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | fn header_ptr(&self) -> NonNull<Header> {
self.raw.header_ptr()
}
}
impl<S: 'static> Notified<S> {
fn header(&self) -> &Header {
self.0.header()
}
}
impl<S: 'static> Notified<S> {
pub(crate) unsafe fn from_raw(ptr: RawTask) -> Notified<S> {
Notified(Task::new(ptr))
}
}
imp... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | }
}
impl<S: Schedule> UnownedTask<S> {
// Used in test of the inject queue.
#[cfg(test)]
#[cfg_attr(target_family = "wasm", allow(dead_code))]
pub(super) fn into_notified(self) -> Notified<S> {
Notified(self.into_task())
}
fn into_task(self) -> Task<S> {
// Convert into a task.... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | pub(crate) fn shutdown(self) {
self.into_task().shutdown()
}
}
impl<S: 'static> Drop for Task<S> {
fn drop(&mut self) {
// Decrement the ref count
if self.header().state.ref_dec() {
// Deallocate if this is the final ref count
self.raw.dealloc();
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/task/mod.rs | 441 | 497 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | /// 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.raw.header_ptr()
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::from_raw(ptr)
}
unsafe f... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/task/mod.rs | 481 | 497 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | fn header_ptr(&self) -> NonNull<Header> {
self.raw.header_ptr()
}
}
impl<S: 'static> Notified<S> {
fn header(&self) -> &Header {
self.0.header()
}
}
impl<S: 'static> Notified<S> {
pub(crate) unsafe fn from_raw(ptr: RawTask) -> Notified<S> {
Notified(Task::new(ptr))
}
}
imp... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | }
}
impl<S: Schedule> UnownedTask<S> {
// Used in test of the inject queue.
#[cfg(test)]
#[cfg_attr(tokio_wasm, allow(dead_code))]
pub(super) fn into_notified(self) -> Notified<S> {
Notified(self.into_task())
}
fn into_task(self) -> Task<S> {
// Convert into a task.
let... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! the API exposed by the task module, so this has to be safe. In either case,
//! the lock in the RUNNING bitfield makes the inner call return immediately. If
//! the inner call is a `shutdown` call, then the CANCELLED bit is set, and the
//! poll call will notice it when the poll finishes, and the task is cancelled
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | use self::raw::RawTask;
mod state;
use self::state::State;
mod waker;
cfg_taskdump! {
pub(crate) mod trace;
}
use crate::future::Future;
use crate::util::linked_list;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::{fmt, mem};
/// An owned handle to the task, tracked by ref count.
#[repr(transpa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | pub(crate) struct LocalNotified<S: 'static> {
task: Task<S>,
_not_send: PhantomData<*const ()>,
}
/// A task that is not owned by any OwnedTasks. Used for blocking tasks.
/// This type holds two ref-counts.
pub(crate) struct UnownedTask<S: 'static> {
raw: RawTask,
_p: PhantomData<S>,
}
// safety: This... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | }
cfg_rt! {
/// This is the constructor for a new task. Three references to the task are
/// created. The first task reference is usually put into an OwnedTasks
/// immediately. The Notified is sent to the scheduler as an ordinary
/// notification.
fn new_task<T, S>(
task: T,
schedu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | {
let (task, notified, join) = new_task(task, scheduler, id);
// This transfers the ref-count of task and notified into an UnownedTask.
// This is valid because an UnownedTask holds two ref-counts.
let unowned = UnownedTask {
raw: task.raw,
_p: PhantomData,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | self.raw.header_ptr()
}
}
impl<S: 'static> Notified<S> {
fn header(&self) -> &Header {
self.0.header()
}
}
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) ->... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | /// Runs the task.
pub(crate) fn run(self) {
let raw = self.task.raw;
mem::forget(self);
raw.poll();
}
}
impl<S: Schedule> UnownedTask<S> {
// Used in test of the inject queue.
#[cfg(test)]
#[cfg_attr(tokio_wasm, allow(dead_code))]
pub(super) fn into_notified(self) -> No... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | // Use the other ref-count to poll the task.
raw.poll();
// Decrement our extra ref-count
drop(task);
}
pub(crate) fn shutdown(self) {
self.into_task().shutdown()
}
}
impl<S: 'static> Drop for Task<S> {
fn drop(&mut self) {
// Decrement the ref count
if ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | }
}
/// # 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.raw.header_ptr()
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::from_raw(pt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/mod.rs | 481 | 502 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! the API exposed by the task module, so this has to be safe. In either case,
//! the lock in the RUNNING bitfield makes the inner call return immediately. If
//! the inner call is a `shutdown` call, then the CANCELLED bit is set, and the
//! poll call will notice it when the poll finishes, and the task is cancelled
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | mod raw;
use self::raw::RawTask;
mod state;
use self::state::State;
mod waker;
cfg_taskdump! {
pub(crate) mod trace;
}
use crate::future::Future;
use crate::util::linked_list;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::{fmt, mem};
/// An owned handle to the task, tracked by ref count.
#[rep... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | /// where it is safe to poll it.
#[repr(transparent)]
pub(crate) struct LocalNotified<S: 'static> {
task: Task<S>,
_not_send: PhantomData<*const ()>,
}
/// A task that is not owned by any OwnedTasks. Used for blocking tasks.
/// This type holds two ref-counts.
pub(crate) struct UnownedTask<S: 'static> {
ra... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | // By default, do nothing. This maintains the 1.0 behavior.
}
}
cfg_rt! {
/// This is the constructor for a new task. Three references to the task are
/// created. The first task reference is usually put into an OwnedTasks
/// immediately. The Notified is sent to the scheduler as an ordinary
/// no... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | T: Send + Future + 'static,
T::Output: Send + 'static,
{
let (task, notified, join) = new_task(task, scheduler, id);
// This transfers the ref-count of task and notified into an UnownedTask.
// This is valid because an UnownedTask holds two ref-counts.
let unowned = UnownedT... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | fn header_ptr(&self) -> NonNull<Header> {
self.raw.header_ptr()
}
}
impl<S: 'static> Notified<S> {
fn header(&self) -> &Header {
self.0.header()
}
}
cfg_rt_multi_thread! {
impl<S: 'static> Notified<S> {
unsafe fn from_raw(ptr: NonNull<Header>) -> Notified<S> {
Notif... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | }
}
impl<S: Schedule> LocalNotified<S> {
/// Runs the task.
pub(crate) fn run(self) {
let raw = self.task.raw;
mem::forget(self);
raw.poll();
}
}
impl<S: Schedule> UnownedTask<S> {
// Used in test of the inject queue.
#[cfg(test)]
#[cfg_attr(tokio_wasm, allow(dead_code)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | raw,
_p: PhantomData,
};
// Use the other ref-count to poll the task.
raw.poll();
// Decrement our extra ref-count
drop(task);
}
pub(crate) fn shutdown(self) {
self.into_task().shutdown()
}
}
impl<S: 'static> Drop for Task<S> {
fn drop(&mut ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! the API exposed by the task module, so this has to be safe. In either case,
//! the lock in the RUNNING bitfield makes the inner call return immediately. If
//! the inner call is a `shutdown` call, then the CANCELLED bit is set, and the
//! poll call will notice it when the poll finishes, and the task is cancelled
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 048049f8883f1bc73ee5d3fa3c94e61cf41d1e38 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/048049f8883f1bc73ee5d3fa3c94e61cf41d1e38/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | mod raw;
use self::raw::RawTask;
mod state;
use self::state::State;
mod waker;
use crate::future::Future;
use crate::util::linked_list;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::{fmt, mem};
/// An owned handle to the task, tracked by ref count.
#[repr(transparent)]
pub(crate) struct Task<S: 'st... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 048049f8883f1bc73ee5d3fa3c94e61cf41d1e38 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/048049f8883f1bc73ee5d3fa3c94e61cf41d1e38/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | cfg_rt! {
/// This is the constructor for a new task. Three references to the task are
/// created. The first task reference is usually put into an OwnedTasks
/// immediately. The Notified is sent to the scheduler as an ordinary
/// notification.
fn new_task<T, S>(
task: T,
scheduler... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 048049f8883f1bc73ee5d3fa3c94e61cf41d1e38 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/048049f8883f1bc73ee5d3fa3c94e61cf41d1e38/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | // This transfers the ref-count of task and notified into an UnownedTask.
// This is valid because an UnownedTask holds two ref-counts.
let unowned = UnownedTask {
raw: task.raw,
_p: PhantomData,
};
std::mem::forget(task);
std::mem::forget(notified);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 048049f8883f1bc73ee5d3fa3c94e61cf41d1e38 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/048049f8883f1bc73ee5d3fa3c94e61cf41d1e38/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | Notified(Task::from_raw(ptr))
}
}
impl<S: 'static> Task<S> {
fn into_raw(self) -> NonNull<Header> {
let ret = self.raw.header_ptr();
mem::forget(self);
ret
}
}
impl<S: 'static> Notified<S> {
fn into_raw(self) -> NonNull<Header> {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 048049f8883f1bc73ee5d3fa3c94e61cf41d1e38 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/048049f8883f1bc73ee5d3fa3c94e61cf41d1e38/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | #[cfg_attr(tokio_wasm, allow(dead_code))]
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,
_p: PhantomData,
};
mem::forget(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 048049f8883f1bc73ee5d3fa3c94e61cf41d1e38 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/048049f8883f1bc73ee5d3fa3c94e61cf41d1e38/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | impl<S: 'static> Drop for Task<S> {
fn drop(&mut self) {
// Decrement the ref count
if self.header().state.ref_dec() {
// Deallocate if this is the final ref count
self.raw.dealloc();
}
}
}
impl<S: 'static> Drop for UnownedTask<S> {
fn drop(&mut self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 048049f8883f1bc73ee5d3fa3c94e61cf41d1e38 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/048049f8883f1bc73ee5d3fa3c94e61cf41d1e38/tokio/src/runtime/task/mod.rs | 441 | 491 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | handle.raw.header_ptr()
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::from_raw(ptr)
}
unsafe fn pointers(target: NonNull<Header>) -> NonNull<linked_list::Pointers<Header>> {
self::core::Trailer::addr_of_owned(Header::get_trailer(target))
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 048049f8883f1bc73ee5d3fa3c94e61cf41d1e38 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/048049f8883f1bc73ee5d3fa3c94e61cf41d1e38/tokio/src/runtime/task/mod.rs | 481 | 491 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! the API exposed by the task module, so this has to be safe. In either case,
//! the lock in the RUNNING bitfield makes the inner call return immediately. If
//! the inner call is a `shutdown` call, then the CANCELLED bit is set, and the
//! poll call will notice it when the poll finishes, and the task is cancelled
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 39766220f4adc969ef7d026e04d752f5dfe55fb9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/39766220f4adc969ef7d026e04d752f5dfe55fb9/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | pub(crate) use self::list::{LocalOwnedTasks, OwnedTasks};
mod raw;
use self::raw::RawTask;
mod state;
use self::state::State;
mod waker;
use crate::future::Future;
use crate::util::linked_list;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::{fmt, mem};
/// An opaque ID that uniquely identifies a ta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 39766220f4adc969ef7d026e04d752f5dfe55fb9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/39766220f4adc969ef7d026e04d752f5dfe55fb9/tokio/src/runtime/task/mod.rs | 201 | 260 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.