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:7 | /// Returns the [`Id`] of the currently running task.
///
/// # Panics
///
/// This function panics if called from outside a task. Please note that calls
/// to `block_on` do not have task IDs, so the method will panic if called from
/// within a call to `block_on`. For a version of this function that doesn't
/// panic... | 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 | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | /// An owned handle to the task, tracked by ref count.
#[repr(transparent)]
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... | 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 | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | pub(crate) type Result<T> = std::result::Result<T, JoinError>;
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 module will batch
/// the ref-dec with setting other option... | 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 | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | let raw = RawTask::new::<T, S>(task, scheduler, id);
let task = Task {
raw,
_p: PhantomData,
};
let notified = Notified(Task {
raw,
_p: PhantomData,
});
let join = JoinHandle::new(raw);
(task, notified, join)
}
///... | 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 | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
fn header(&self) -> &Header {
self.raw.header()
}
fn header_ptr(&self) -> NonNull<Header> {
self.raw.header_ptr()
}
}
impl<S: 'sta... | 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 | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | }
}
}
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 | 39766220f4adc969ef7d026e04d752f5dfe55fb9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/39766220f4adc969ef7d026e04d752f5dfe55fb9/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | 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> {
raw,
_p: PhantomData,
};
// Use the other ref-count to poll the task.
raw.poll();
... | 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 | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | self.raw.dealloc();
}
}
}
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, "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 | 521 | 576 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:15 | }
}
impl Id {
pub(crate) fn next() -> Self {
use crate::loom::sync::atomic::{Ordering::Relaxed, StaticAtomicU64};
static NEXT_ID: StaticAtomicU64 = StaticAtomicU64::new(1);
Self(NEXT_ID.fetch_add(1, Relaxed))
}
pub(crate) fn as_u64(&self) -> u64 {
self.0
}
} | 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 | 561 | 576 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | self.raw.dealloc();
}
}
}
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, "ta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 718d6ce8cac9f2e081c0abf043fb13d7859ec16c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/718d6ce8cac9f2e081c0abf043fb13d7859ec16c/tokio/src/runtime/task/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:15 | }
}
impl Id {
// When 64-bit atomics are available, use a static `AtomicU64` counter to
// generate task IDs.
//
// Note(eliza): we _could_ just use `crate::loom::AtomicU64`, which switches
// between an atomic and mutex-based implementation here, rather than having
// two separate functions fo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 718d6ce8cac9f2e081c0abf043fb13d7859ec16c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/718d6ce8cac9f2e081c0abf043fb13d7859ec16c/tokio/src/runtime/task/mod.rs | 561 | 619 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:16 | fn init_next_id() -> Mutex<u64> {
Mutex::new(1)
}
static NEXT_ID: OnceCell<Mutex<u64>> = OnceCell::new();
let next_id = NEXT_ID.get(init_next_id);
let mut lock = next_id.lock();
let id = *lock;
*lock +=... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 718d6ce8cac9f2e081c0abf043fb13d7859ec16c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/718d6ce8cac9f2e081c0abf043fb13d7859ec16c/tokio/src/runtime/task/mod.rs | 601 | 619 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | //! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawned from.
//! 2. Since `JoinHandle<Output>` is not Send if Output is not Send, the
//! JoinHandle is also on t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | mod abort;
mod join;
#[cfg(feature = "rt")]
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::abort::AbortHandle;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::join::JoinHandle;
mod list;
pub(crate) use self::list::{LocalOwnedTasks, ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | /// the [`JoinHandle::id()`](crate::task::JoinHandle::id()) function.
///
/// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1.x releases. See [the documentation on unstable
/// features][unstable] for details.
///
/// [unstable]: crate#unstable-features
#[cfg_attr(docsrs,... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | /// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1.x releases. See [the documentation on unstable
/// features][unstable] for details.
///
/// [task ID]: crate::task::Id
/// [unstable]: crate#unstable-features
#[cfg_attr(not(tokio_unstable), allow(unreachable_pub))]
#[trac... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | /// 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> Sync for UnownedTask<S> {}
/// Task result sent back.
pub(crate) type Result<... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | /// notification.
fn new_task<T, S>(
task: T,
scheduler: S,
id: Id,
) -> (Task<S>, Notified<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Future + 'static,
T::Output: 'static,
{
let raw = RawTask::new::<T, S>(task, scheduler, id);
let ta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | raw: task.raw,
_p: PhantomData,
};
std::mem::forget(task);
std::mem::forget(notified);
(unowned, join)
}
}
impl<S: 'static> Task<S> {
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: Phanto... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | 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> {
self.0.into_raw()
}
}
}
impl<S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | fn into_task(self) -> Task<S> {
// Convert into a task.
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) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | // Deallocate if this is the final ref count
self.raw.dealloc();
}
}
}
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
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | 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))
}
}
impl fmt::Display for Id {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:15 | let id = *lock;
*lock += 1;
Self(id)
}
}
cfg_not_has_const_mutex_new! {
pub(crate) fn next() -> Self {
use crate::util::once_cell::OnceCell;
use crate::loom::sync::Mutex;
fn init_next_id() -> Mutex<... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/mod.rs | 561 | 590 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | /// notification.
fn new_task<T, S>(
task: T,
scheduler: S,
id: Id,
) -> (Task<S>, Notified<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Future + 'static,
T::Output: 'static,
{
let raw = RawTask::new::<T, S>(task, scheduler, id);
let ta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 71bd49e146ac5288fd4cb327dd3f86eb71b3a865 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | //! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawned from.
//! 2. Since `JoinHandle<Output>` is not Send if Output is not Send, the
//! JoinHandle is also on t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1ab80ba580f9cf361374cfb8c81e424e619811a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ab80ba580f9cf361374cfb8c81e424e619811a3/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | #[cfg(feature = "rt")]
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::abort::AbortHandle;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::join::JoinHandle;
mod list;
pub(crate) use self::list::{LocalOwnedTasks, OwnedTasks};
mod raw;... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1ab80ba580f9cf361374cfb8c81e424e619811a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ab80ba580f9cf361374cfb8c81e424e619811a3/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | /// [unstable]: crate#unstable-features
#[cfg_attr(docsrs, doc(cfg(all(feature = "rt", tokio_unstable))))]
#[cfg_attr(not(tokio_unstable), allow(unreachable_pub))]
// TODO(eliza): there's almost certainly no reason not to make this `Copy` as well...
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
pub struct Id(u64);
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1ab80ba580f9cf361374cfb8c81e424e619811a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ab80ba580f9cf361374cfb8c81e424e619811a3/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | // safety: This type can only be created given a Send task.
unsafe impl<S> Send for UnownedTask<S> {}
unsafe impl<S> Sync for UnownedTask<S> {}
/// Task result sent back.
pub(crate) type Result<T> = std::result::Result<T, JoinError>;
pub(crate) trait Schedule: Sync + Sized + 'static {
/// The task has completed w... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1ab80ba580f9cf361374cfb8c81e424e619811a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ab80ba580f9cf361374cfb8c81e424e619811a3/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | ) -> (Task<S>, Notified<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Future + 'static,
T::Output: 'static,
{
let raw = RawTask::new::<T, S>(task, scheduler, id.clone());
let task = Task {
raw,
_p: PhantomData,
};
let notified = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1ab80ba580f9cf361374cfb8c81e424e619811a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ab80ba580f9cf361374cfb8c81e424e619811a3/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | (unowned, join)
}
}
impl<S: 'static> Task<S> {
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
fn header(&self) -> &Header {
self.raw.header()
}
fn header_ptr(&self) -> NonNull<Heade... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1ab80ba580f9cf361374cfb8c81e424e619811a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ab80ba580f9cf361374cfb8c81e424e619811a3/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | }
}
impl<S: 'static> Notified<S> {
fn into_raw(self) -> NonNull<Header> {
self.0.into_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;
mem::forge... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1ab80ba580f9cf361374cfb8c81e424e619811a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ab80ba580f9cf361374cfb8c81e424e619811a3/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | _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);
// Transfer one ref-count to a Task object.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1ab80ba580f9cf361374cfb8c81e424e619811a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ab80ba580f9cf361374cfb8c81e424e619811a3/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | 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, fmt: ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1ab80ba580f9cf361374cfb8c81e424e619811a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ab80ba580f9cf361374cfb8c81e424e619811a3/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | }
}
impl fmt::Display for Id {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl Id {
// When 64-bit atomics are available, use a static `AtomicU64` counter to
// generate task IDs.
//
// Note(eliza): we _could_ just use `crate::loom::AtomicU64`, which s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1ab80ba580f9cf361374cfb8c81e424e619811a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ab80ba580f9cf361374cfb8c81e424e619811a3/tokio/src/runtime/task/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | cfg_not_has_const_mutex_new! {
pub(crate) fn next() -> Self {
use crate::util::once_cell::OnceCell;
use crate::loom::sync::Mutex;
fn init_next_id() -> Mutex<u64> {
Mutex::new(1)
}
static NEXT_ID: OnceCell<M... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1ab80ba580f9cf361374cfb8c81e424e619811a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ab80ba580f9cf361374cfb8c81e424e619811a3/tokio/src/runtime/task/mod.rs | 521 | 545 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | //! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawned from.
//! 2. Since JoinHandle<Output> is not Send if Output is not Send, the
//! JoinHandle is also on the... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | f4e08aec66b010130b7b7b048ccb987654af349b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f4e08aec66b010130b7b7b048ccb987654af349b/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | //! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawned from.
//! 2. Since JoinHandle<Output> is not Send if Output is not Send, the
//! JoinHandle is also on the... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 05e661490b87a3d60a8342535bdc9d213048519c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/05e661490b87a3d60a8342535bdc9d213048519c/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | #[cfg(all(feature = "rt", any(tokio_unstable, test)))]
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::abort::AbortHandle;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::join::JoinHandle;
mod list;
pub(crate) use self::list::{LocalOw... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 05e661490b87a3d60a8342535bdc9d213048519c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/05e661490b87a3d60a8342535bdc9d213048519c/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | // safety: This type can only be created given a Send task.
unsafe impl<S> Send for UnownedTask<S> {}
unsafe impl<S> Sync for UnownedTask<S> {}
/// Task result sent back.
pub(crate) type Result<T> = std::result::Result<T, JoinError>;
pub(crate) trait Schedule: Sync + Sized + 'static {
/// The task has completed w... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 05e661490b87a3d60a8342535bdc9d213048519c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/05e661490b87a3d60a8342535bdc9d213048519c/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | {
let raw = RawTask::new::<T, S>(task, scheduler, id.clone());
let task = Task {
raw,
_p: PhantomData,
};
let notified = Notified(Task {
raw,
_p: PhantomData,
});
let join = JoinHandle::new(raw, id);
(task, notified... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 05e661490b87a3d60a8342535bdc9d213048519c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/05e661490b87a3d60a8342535bdc9d213048519c/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | impl<S: 'static> Task<S> {
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
fn header(&self) -> &Header {
self.raw.header()
}
}
impl<S: 'static> Notified<S> {
fn header(&self) -> &Header {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 05e661490b87a3d60a8342535bdc9d213048519c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/05e661490b87a3d60a8342535bdc9d213048519c/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | impl<S: Schedule> Task<S> {
/// Pre-emptively 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 | 05e661490b87a3d60a8342535bdc9d213048519c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/05e661490b87a3d60a8342535bdc9d213048519c/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | 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 | 05e661490b87a3d60a8342535bdc9d213048519c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/05e661490b87a3d60a8342535bdc9d213048519c/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | }
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 | 05e661490b87a3d60a8342535bdc9d213048519c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/05e661490b87a3d60a8342535bdc9d213048519c/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | impl Id {
// When 64-bit atomics are available, use a static `AtomicU64` counter to
// generate task IDs.
//
// Note(eliza): we _could_ just use `crate::loom::AtomicU64`, which switches
// between an atomic and mutex-based implementation here, rather than having
// two separate functions for tar... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 05e661490b87a3d60a8342535bdc9d213048519c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/05e661490b87a3d60a8342535bdc9d213048519c/tokio/src/runtime/task/mod.rs | 481 | 523 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | }
}
impl fmt::Display for Id {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl Id {
// When 64-bit atomics are available, use a static `AtomicU64` counter to
// generate task IDs.
//
// Note(eliza): we _could_ just use `crate::loom::AtomicU64`, which s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe/tokio/src/runtime/task/mod.rs | 481 | 525 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | }
}
impl<S: 'static> Notified<S> {
fn into_raw(self) -> NonNull<Header> {
self.0.into_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;
mem::forge... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | }
}
impl<S: 'static> Notified<S> {
fn into_raw(self) -> NonNull<Header> {
self.0.into_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;
mem::forge... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | f3e340a35b306e926e78537a0dd65b2e9b9cdc89 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f3e340a35b306e926e78537a0dd65b2e9b9cdc89/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | (unowned, join)
}
}
impl<S: 'static> Task<S> {
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
fn header(&self) -> &Header {
self.raw.header()
}
fn header_ptr(&self) -> NonNull<Heade... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 228d4fce992124fc646a2e49606a65847166413c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | }
}
impl<S: 'static> Notified<S> {
fn into_raw(self) -> NonNull<Header> {
self.0.into_raw()
}
}
}
impl<S: Schedule> Task<S> {
/// Pre-emptively cancels the task as part of the shutdown process.
pub(crate) fn shutdown(self) {
let raw = self.raw;
mem::forg... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 228d4fce992124fc646a2e49606a65847166413c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | ) -> (Task<S>, Notified<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Future + 'static,
T::Output: 'static,
{
let raw = RawTask::new::<T, S>(task, scheduler, id.clone());
let task = Task {
raw,
_p: PhantomData,
};
let notified = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6f048ca954aa5f285f1cf6310d447e7c079c1c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | (unowned, join)
}
}
impl<S: 'static> Task<S> {
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
fn header(&self) -> &Header {
self.raw.header()
}
}
impl<S: 'static> Notified<S> {
fn h... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6f048ca954aa5f285f1cf6310d447e7c079c1c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | fn into_raw(self) -> NonNull<Header> {
self.0.into_raw()
}
}
}
impl<S: Schedule> Task<S> {
/// Pre-emptively 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: S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6f048ca954aa5f285f1cf6310d447e7c079c1c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | // 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> {
raw,
_p: Phanto... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6f048ca954aa5f285f1cf6310d447e7c079c1c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | 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 {
write!(fmt, "Task({:p})", self.header())
}
}
impl<S> fmt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6f048ca954aa5f285f1cf6310d447e7c079c1c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl Id {
// When 64-bit atomics are available, use a static `AtomicU64` counter to
// generate task IDs.
//
// Note(eliza): we _could_ just use `crate::loom::AtomicU64`, which switches
// between an atomic and... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 6f048ca954aa5f285f1cf6310d447e7c079c1c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f048ca954aa5f285f1cf6310d447e7c079c1c3d/tokio/src/runtime/task/mod.rs | 481 | 521 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | 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 {
write!(fmt, "Task({:p})", self.header())
}
}
impl<S> fmt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c98be229ff3a4e1e230711844b7e38a30cb64f2c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | impl fmt::Display for Id {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl Id {
// When 64-bit atomics are available, use a static `AtomicU64` counter to
// generate task IDs.
//
// Note(eliza): we _could_ just use `crate::loom::AtomicU64`, which switch... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c98be229ff3a4e1e230711844b7e38a30cb64f2c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/mod.rs | 481 | 522 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | impl Id {
// When 64-bit atomics are available, use a static `AtomicU64` counter to
// generate task IDs.
//
// Note(eliza): we _could_ just use `crate::loom::AtomicU64`, which switches
// between an atomic and mutex-based implementation here, rather than having
// two separate functions for tar... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/mod.rs | 481 | 517 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | #[cfg(all(feature = "rt", any(tokio_unstable, test)))]
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::abort::AbortHandle;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::join::JoinHandle;
mod list;
pub(crate) use self::list::{LocalOw... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | // 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 for Notified<S> {}
/// A non-Send variant of Notified with the invariant that it is on a threa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | fn yield_now(&self, task: Notified<Self>) {
self.schedule(task);
}
}
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 ordina... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | T: Send + Future + 'static,
T::Output: Send + 'static,
{
let (task, notified, join) = new_task(task, scheduler);
// 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 ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | 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 | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | #[cfg_attr(target_arch = "wasm32", 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,
};
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | 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 | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/mod.rs | 401 | 452 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | 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>> {
// Not super great as it avoids some of looms checking...
NonNull::from(target.as_ref().... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/mod.rs | 441 | 452 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | //! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawned from.
//! 2. Since JoinHandle<Output> is not Send if Output is not Send, the
//! JoinHandle is also on the... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 37917b821d58f2ce3f7be109bf4d309d78bd8740 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37917b821d58f2ce3f7be109bf4d309d78bd8740/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | mod list;
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 owned handle to the task, tra... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 37917b821d58f2ce3f7be109bf4d309d78bd8740 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37917b821d58f2ce3f7be109bf4d309d78bd8740/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | #[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> {
raw: RawTask,
_p: PhantomData<S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 37917b821d58f2ce3f7be109bf4d309d78bd8740 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37917b821d58f2ce3f7be109bf4d309d78bd8740/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | /// 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
) -> (Task<S>, Notified<S>, JoinHandle<T::Output>)
where
S: Schedule,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 37917b821d58f2ce3f7be109bf4d309d78bd8740 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37917b821d58f2ce3f7be109bf4d309d78bd8740/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | let unowned = UnownedTask {
raw: task.raw,
_p: PhantomData,
};
std::mem::forget(task);
std::mem::forget(notified);
(unowned, join)
}
}
impl<S: 'static> Task<S> {
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTas... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 37917b821d58f2ce3f7be109bf4d309d78bd8740 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37917b821d58f2ce3f7be109bf4d309d78bd8740/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | mem::forget(self);
ret
}
}
impl<S: 'static> Notified<S> {
fn into_raw(self) -> NonNull<Header> {
self.0.into_raw()
}
}
}
impl<S: Schedule> Task<S> {
/// Pre-emptively 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 | 37917b821d58f2ce3f7be109bf4d309d78bd8740 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37917b821d58f2ce3f7be109bf4d309d78bd8740/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | 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 | 37917b821d58f2ce3f7be109bf4d309d78bd8740 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37917b821d58f2ce3f7be109bf4d309d78bd8740/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | }
}
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 | 37917b821d58f2ce3f7be109bf4d309d78bd8740 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37917b821d58f2ce3f7be109bf4d309d78bd8740/tokio/src/runtime/task/mod.rs | 401 | 445 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | //! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawned from.
//! 2. Since JoinHandle<Output> is not Send if Output is not Send, the
//! JoinHandle is also on the... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1be8e9dfb7b1140568ac10ac34f5f8171a89e40d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | 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 | 1be8e9dfb7b1140568ac10ac34f5f8171a89e40d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | }
/// 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 | 1be8e9dfb7b1140568ac10ac34f5f8171a89e40d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | 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 {
raw,
_p: PhantomData,
};
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1be8e9dfb7b1140568ac10ac34f5f8171a89e40d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | std::mem::forget(task);
std::mem::forget(notified);
(unowned, join)
}
}
impl<S: 'static> Task<S> {
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
fn header(&self) -> &Header {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1be8e9dfb7b1140568ac10ac34f5f8171a89e40d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | impl<S: 'static> Notified<S> {
fn into_raw(self) -> NonNull<Header> {
self.0.into_raw()
}
}
}
impl<S: Schedule> Task<S> {
/// Pre-emptively cancels the task as part of the shutdown process.
pub(crate) fn shutdown(self) {
let raw = self.raw;
mem::forget(self);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 1be8e9dfb7b1140568ac10ac34f5f8171a89e40d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | 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 | 1be8e9dfb7b1140568ac10ac34f5f8171a89e40d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | 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 | 1be8e9dfb7b1140568ac10ac34f5f8171a89e40d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/mod.rs | 401 | 441 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | std::mem::forget(task);
std::mem::forget(notified);
(unowned, join)
}
}
impl<S: 'static> Task<S> {
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
fn header(&self) -> &Header {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | 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 | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/src/runtime/task/mod.rs | 401 | 441 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | impl<S: 'static> Notified<S> {
fn into_raw(self) -> NonNull<Header> {
self.0.into_raw()
}
}
}
impl<S: Schedule> Task<S> {
/// Pre-emptively cancels the task as part of the shutdown process.
pub(crate) fn shutdown(self) {
let raw = self.raw;
mem::forget(self);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 4c571b55b10b39255548a995a876883260b0bfeb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c571b55b10b39255548a995a876883260b0bfeb/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | // 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> {
raw,
_p: Phanto... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 4c571b55b10b39255548a995a876883260b0bfeb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c571b55b10b39255548a995a876883260b0bfeb/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | // 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 {
write!(fmt, "Task({:p})", ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 4c571b55b10b39255548a995a876883260b0bfeb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c571b55b10b39255548a995a876883260b0bfeb/tokio/src/runtime/task/mod.rs | 401 | 440 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:4 | //! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawned from.
//! 2. Since JoinHandle<Output> is not Send if Output is not Send, the
//! JoinHandle is also on the... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 4152918a39214d22e4b9e8d2148641b38b4f1c6e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4152918a39214d22e4b9e8d2148641b38b4f1c6e/tokio/src/runtime/task/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | 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: 'sta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 4152918a39214d22e4b9e8d2148641b38b4f1c6e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4152918a39214d22e4b9e8d2148641b38b4f1c6e/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | }
/// 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 | 4152918a39214d22e4b9e8d2148641b38b4f1c6e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4152918a39214d22e4b9e8d2148641b38b4f1c6e/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | 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 {
raw,
_p: PhantomData,
};
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 4152918a39214d22e4b9e8d2148641b38b4f1c6e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4152918a39214d22e4b9e8d2148641b38b4f1c6e/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | std::mem::forget(task);
std::mem::forget(notified);
(unowned, join)
}
}
impl<S: 'static> Task<S> {
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task {
raw: RawTask::from_raw(ptr),
_p: PhantomData,
}
}
fn header(&self) -> &Header {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 4152918a39214d22e4b9e8d2148641b38b4f1c6e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4152918a39214d22e4b9e8d2148641b38b4f1c6e/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | impl<S: 'static> Notified<S> {
fn into_raw(self) -> NonNull<Header> {
self.0.into_raw()
}
}
}
impl<S: Schedule> Task<S> {
/// Pre-emptively cancel the task as part of the shutdown process.
pub(crate) fn shutdown(self) {
let raw = self.raw;
mem::forget(self);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 4152918a39214d22e4b9e8d2148641b38b4f1c6e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4152918a39214d22e4b9e8d2148641b38b4f1c6e/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | // 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 {
write!(fmt, "Task({:p})", ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 4152918a39214d22e4b9e8d2148641b38b4f1c6e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4152918a39214d22e4b9e8d2148641b38b4f1c6e/tokio/src/runtime/task/mod.rs | 401 | 440 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | impl<S: 'static> Notified<S> {
fn into_raw(self) -> NonNull<Header> {
self.0.into_raw()
}
}
}
impl<S: Schedule> Task<S> {
/// Pre-emptively cancel the task as part of the shutdown process.
pub(crate) fn shutdown(self) {
let raw = self.raw;
mem::forget(self);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | // 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);
// Poll the task
raw.poll();
// Decrement our extra ref-count
raw.header().state.ref_dec()... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | }
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 | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/mod.rs | 401 | 434 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:1 | mod core;
use self::core::Cell;
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 join;
#[allow(... | 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 | 1 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.