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/harness.rs:8 | // By transitioning the lifcycle to `Running`, we have permission to
// drop the future.
self.cancel_task();
}
// ====== internal ======
fn cancel_task(self) {
// Drop the future from a panic guard.
let res = panic::catch_unwind(panic::AssertUnwindSafe(|| {
self... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/harness.rs | MIT | a78b1c65ccfb9692ca5d3ed8ddde934f40091d83 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/task/harness.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:9 | mem::forget(task);
true
} else {
false
}
} else {
false
};
// This might deallocate
let snapshot = self
.header()
.state
.transition_to_terminal(!is_join_interested, ref_dec);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/harness.rs | MIT | a78b1c65ccfb9692ca5d3ed8ddde934f40091d83 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/task/harness.rs | 321 | 369 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:2 | /// panic, see [`task::try_id()`](crate::runtime::task::try_id()).
///
/// [task ID]: crate::task::Id
#[track_caller]
pub fn id() -> Id {
context::current_task_id().expect("Can't get a task id when not inside a task")
}
/// Returns the [`Id`] of the currently running task, or `None` if called outside
/// of a task... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/id.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/id.rs | 41 | 91 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:3 | let id = NEXT_ID.fetch_add(1, Relaxed);
if let Some(id) = NonZeroU64::new(id) {
return Self(id);
}
}
}
pub(crate) fn as_u64(&self) -> u64 {
self.0.get()
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/id.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/id.rs | 81 | 91 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:2 | /// panic, see [`task::try_id()`](crate::runtime::task::try_id()).
///
/// [task ID]: crate::task::Id
#[track_caller]
pub fn id() -> Id {
context::current_task_id().expect("Can't get a task id when not inside a task")
}
/// Returns the [`Id`] of the currently running task, or `None` if called outside
/// of a task... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/id.rs | MIT | 7f455b2d9334c89dba03d9dd49a19cc56b791ecd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f455b2d9334c89dba03d9dd49a19cc56b791ecd/tokio/src/runtime/task/id.rs | 41 | 92 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:3 | loop {
let id = NEXT_ID.fetch_add(1, Relaxed);
if let Some(id) = NonZeroU64::new(id) {
return Self(id);
}
}
}
pub(crate) fn as_u64(&self) -> u64 {
self.0.get()
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/id.rs | MIT | 7f455b2d9334c89dba03d9dd49a19cc56b791ecd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f455b2d9334c89dba03d9dd49a19cc56b791ecd/tokio/src/runtime/task/id.rs | 81 | 92 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:1 | use crate::runtime::context;
use std::{fmt, num::NonZeroU64};
/// An opaque ID that uniquely identifies a task relative to all other currently
/// running tasks.
///
/// # Notes
///
/// - Task IDs are unique relative to other *currently running* tasks. When a
/// task completes, the same ID may be used for another ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/id.rs | MIT | dd74c7c1bfd69ee997c57aade1db2326b85855df | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dd74c7c1bfd69ee997c57aade1db2326b85855df/tokio/src/runtime/task/id.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:2 | /// that it returns `None` rather than panicking if called outside of a task
/// context.
///
/// [task ID]: crate::task::Id
#[track_caller]
pub fn try_id() -> Option<Id> {
context::current_task_id()
}
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/id.rs | MIT | dd74c7c1bfd69ee997c57aade1db2326b85855df | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dd74c7c1bfd69ee997c57aade1db2326b85855df/tokio/src/runtime/task/id.rs | 41 | 80 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:1 | use crate::runtime::context;
use std::{fmt, num::NonZeroU64};
/// An opaque ID that uniquely identifies a task relative to all other currently
/// running tasks.
///
/// # Notes
///
/// - Task IDs are unique relative to other *currently running* tasks. When a
/// task completes, the same ID may be used for another ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/id.rs | MIT | b68f5c7f38b821b01d148027a03a0dbc177932ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b68f5c7f38b821b01d148027a03a0dbc177932ee/tokio/src/runtime/task/id.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:2 | ///
/// [task ID]: crate::task::Id
/// [unstable]: crate#unstable-features
#[cfg_attr(not(tokio_unstable), allow(unreachable_pub))]
#[track_caller]
pub fn id() -> Id {
context::current_task_id().expect("Can't get a task id when not inside a task")
}
/// Returns the [`Id`] of the currently running task, or `None` i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/id.rs | MIT | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/id.rs | 41 | 99 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:3 | crate::loom::lazy_static! {
static ref NEXT_ID: StaticAtomicU64 = StaticAtomicU64::new(1);
}
#[cfg(not(all(test, loom)))]
static NEXT_ID: StaticAtomicU64 = StaticAtomicU64::new(1);
loop {
let id = NEXT_ID.fetch_add(1, Relaxed);
if let Some(id) = NonZ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/id.rs | MIT | 338e13b04baa3cf8db3feb1ba2266c0070a9efdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/338e13b04baa3cf8db3feb1ba2266c0070a9efdf/tokio/src/runtime/task/id.rs | 81 | 99 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:2 | ///
/// [task ID]: crate::task::Id
/// [unstable]: crate#unstable-features
#[cfg_attr(not(tokio_unstable), allow(unreachable_pub))]
#[track_caller]
pub fn id() -> Id {
context::current_task_id().expect("Can't get a task id when not inside a task")
}
/// Returns the [`Id`] of the currently running task, or `None` i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/id.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/task/id.rs | 41 | 98 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:3 | {
crate::loom::lazy_static! {
static ref NEXT_ID: StaticAtomicU64 = StaticAtomicU64::new(1);
}
Self(NEXT_ID.fetch_add(1, Relaxed))
}
#[cfg(not(all(test, loom)))]
{
static NEXT_ID: StaticAtomicU64 = StaticAtomicU64::new(1);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/id.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/task/id.rs | 81 | 98 |
tokio-rs/tokio:tokio/src/runtime/task/id.rs:2 | ///
/// [task ID]: crate::task::Id
/// [unstable]: crate#unstable-features
#[cfg_attr(not(tokio_unstable), allow(unreachable_pub))]
#[track_caller]
pub fn id() -> Id {
context::current_task_id().expect("Can't get a task id when not inside a task")
}
/// Returns the [`Id`] of the currently running task, or `None` i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/id.rs | MIT | 048049f8883f1bc73ee5d3fa3c94e61cf41d1e38 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/048049f8883f1bc73ee5d3fa3c94e61cf41d1e38/tokio/src/runtime/task/id.rs | 41 | 87 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:1 | //! Inject queue used to send wakeups to a work-stealing scheduler
use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::{Mutex, MutexGuard};
use crate::runtime::task;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::sync::atomic::Ordering::{Acquire, Release};
/// Growable, MPMC queue used ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/task/inject.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:2 | unsafe impl<T> Send for Inject<T> {}
unsafe impl<T> Sync for Inject<T> {}
impl<T: 'static> Inject<T> {
pub(crate) fn new() -> Inject<T> {
Inject {
pointers: Mutex::new(Pointers {
is_closed: false,
head: None,
tail: None,
}),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/task/inject.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:3 | self.len.load(Acquire)
}
/// Pushes a value into the queue.
///
/// This does nothing if the queue is closed.
pub(crate) fn push(&self, task: task::Notified<T>) {
// Acquire queue lock
let mut p = self.pointers.lock();
if p.is_closed {
return;
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/task/inject.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:4 | // Fast path, if len == 0, then there are no values
if self.is_empty() {
return Pop {
len: 0,
pointers: None,
_p: PhantomData,
};
}
// Lock the queue
let p = self.pointers.lock();
// safety: All updates to ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/task/inject.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:5 | None => return,
};
// Link up all the tasks.
let mut prev = first;
let mut counter = 1;
// We are going to be called with an `std::iter::Chain`, and that
// iterator overrides `for_each` to something that is easier for the
// compiler... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/task/inject.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:6 | if let Some(tail) = p.tail {
set_next(tail, Some(batch_head));
} else {
p.head = Some(batch_head);
}
p.tail = Some(batch_tail);
// Increment the count.
//
// safety: All updates to the len atomic are guarded by the... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/task/inject.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:7 | self.len -= 1;
if self.len == 0 {
self.pointers = None;
}
ret
}
fn size_hint(&self) -> (usize, Option<usize>) {
(self.len, Some(self.len))
}
}
impl<'a, T: 'static> ExactSizeIterator for Pop<'a, T> {
fn len(&self) -> usize {
self.len
}
}
impl<'... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/task/inject.rs | 241 | 293 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:8 | Some(unsafe { task::Notified::from_raw(task) })
}
}
fn get_next(header: NonNull<task::Header>) -> Option<NonNull<task::Header>> {
unsafe { header.as_ref().queue_next.with(|ptr| *ptr) }
}
fn set_next(header: NonNull<task::Header>, val: Option<NonNull<task::Header>>) {
unsafe {
header.as_ref().set_n... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/task/inject.rs | 281 | 293 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:1 | //! Inject queue used to send wakeups to a work-stealing scheduler
use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::Mutex;
use crate::runtime::task;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::sync::atomic::Ordering::{Acquire, Release};
/// Growable, MPMC queue used to inject new ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/inject.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:2 | pointers: Mutex::new(Pointers {
is_closed: false,
head: None,
tail: None,
}),
len: AtomicUsize::new(0),
_p: PhantomData,
}
}
pub(crate) fn is_empty(&self) -> bool {
self.len() == 0
}
// Kind of annoying... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/inject.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:3 | pub(crate) fn push(&self, task: task::Notified<T>) {
// Acquire queue lock
let mut p = self.pointers.lock();
if p.is_closed {
return;
}
// safety: only mutated with the lock held
let len = unsafe { self.len.unsync_load() };
let task = task.into_raw()... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/inject.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:4 | p.head = get_next(task);
if p.head.is_none() {
p.tail = None;
}
set_next(task, None);
// Decrement the count.
//
// safety: All updates to the len atomic are guarded by the mutex. As
// such, a non-atomic load followed by a store is safe.
se... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/inject.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:5 | iter.for_each(|next| {
let next = next.into_raw();
// safety: Holding the Notified for a task guarantees exclusive
// access to the `queue_next` field.
set_next(prev, Some(next));
prev = next;
counter += 1;
});
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/inject.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:6 | // safety: All updates to the len atomic are guarded by the mutex. As
// such, a non-atomic load followed by a store is safe.
let len = unsafe { self.len.unsync_load() };
self.len.store(len + num, Release);
}
}
}
impl<T: 'static> Drop for Inject<T> {
fn drop(&mut se... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/inject.rs | 201 | 226 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:1 | //! Inject queue used to send wakeups to a work-stealing scheduler
use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::Mutex;
use crate::runtime::task;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::sync::atomic::Ordering::{Acquire, Release};
/// Growable, MPMC queue used to inject new ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/inject.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:2 | pointers: Mutex::new(Pointers {
is_closed: false,
head: None,
tail: None,
}),
len: AtomicUsize::new(0),
_p: PhantomData,
}
}
pub(crate) fn is_empty(&self) -> bool {
self.len() == 0
}
/// Closes the inje... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/inject.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:3 | let mut p = self.pointers.lock();
if p.is_closed {
return;
}
// safety: only mutated with the lock held
let len = unsafe { self.len.unsync_load() };
let task = task.into_raw();
// The next pointer should already be null
debug_assert!(get_next(task).... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/inject.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:4 | // We are going to be called with an `std::iter::Chain`, and that
// iterator overrides `for_each` to something that is easier for the
// compiler to optimize than a loop.
iter.for_each(|next| {
let next = next.into_raw();
// safety: Holding the Notified for a task guara... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/inject.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:5 | p.tail = Some(batch_tail);
// Increment the count.
//
// safety: All updates to the len atomic are guarded by the mutex. As
// such, a non-atomic load followed by a store is safe.
let len = unsafe { self.len.unsync_load() };
self.len.store(len + num, Release);
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/inject.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:6 | }
}
impl<T: 'static> Drop for Inject<T> {
fn drop(&mut self) {
if !std::thread::panicking() {
assert!(self.pop().is_none(), "queue not empty");
}
}
}
fn get_next(header: NonNull<task::Header>) -> Option<NonNull<task::Header>> {
unsafe { header.as_ref().queue_next.with(|ptr| *pt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/inject.rs | 201 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:1 | //! Inject queue used to send wakeups to a work-stealing scheduler
use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::Mutex;
use crate::runtime::task;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::sync::atomic::Ordering::{Acquire, Release};
/// Growable, MPMC queue used to inject new ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/inject.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:2 | pointers: Mutex::new(Pointers {
is_closed: false,
head: None,
tail: None,
}),
len: AtomicUsize::new(0),
_p: PhantomData,
}
}
pub(crate) fn is_empty(&self) -> bool {
self.len() == 0
}
/// Close the injec... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/inject.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:3 | let mut p = self.pointers.lock();
if p.is_closed {
return;
}
// safety: only mutated with the lock held
let len = unsafe { self.len.unsync_load() };
let task = task.into_raw();
// The next pointer should already be null
debug_assert!(get_next(task).... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/inject.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:4 | // We are going to be called with an `std::iter::Chain`, and that
// iterator overrides `for_each` to something that is easier for the
// compiler to optimize than a loop.
iter.for_each(|next| {
let next = next.into_raw();
// safety: Holding the Notified for a task guara... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/inject.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:2 | pointers: Mutex::new(Pointers {
is_closed: false,
head: None,
tail: None,
}),
len: AtomicUsize::new(0),
_p: PhantomData,
}
}
pub(crate) fn is_empty(&self) -> bool {
self.len() == 0
}
/// Close the injec... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/inject.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:3 | let mut p = self.pointers.lock();
if p.is_closed {
return;
}
// safety: only mutated with the lock held
let len = unsafe { self.len.unsync_load() };
let task = task.into_raw();
// The next pointer should already be null
debug_assert!(get_next(task).... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/inject.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:4 | let mut counter = 1;
// We are going to be called with an `std::iter::Chain`, and that
// iterator overrides `for_each` to something that is easier for the
// compiler to optimize than a loop.
iter.map(|next| next.into_raw()).for_each(|next| {
// safety: The caller guarantee... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/inject.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:5 | // Increment the count.
//
// safety: All updates to the len atomic are guarded by the mutex. As
// such, a non-atomic load followed by a store is safe.
let len = unsafe { self.len.unsync_load() };
self.len.store(len + num, Release);
}
pub(crate) fn pop(&self) -> Option... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/inject.rs | 161 | 218 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:6 | impl<T: 'static> Drop for Inject<T> {
fn drop(&mut self) {
if !std::thread::panicking() {
assert!(self.pop().is_none(), "queue not empty");
}
}
}
fn get_next(header: NonNull<task::Header>) -> Option<NonNull<task::Header>> {
unsafe { header.as_ref().queue_next.with(|ptr| *ptr) }
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/inject.rs | 201 | 218 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:2 | pointers: Mutex::new(Pointers {
is_closed: false,
head: None,
tail: None,
}),
len: AtomicUsize::new(0),
_p: PhantomData,
}
}
pub(crate) fn is_empty(&self) -> bool {
self.len() == 0
}
/// Close the injec... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3b38ebd7f5d50611193f942c31c57262f263be33 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b38ebd7f5d50611193f942c31c57262f263be33/tokio/src/runtime/task/inject.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:3 | pub(crate) fn push(&self, task: task::Notified<T>) -> Result<(), task::Notified<T>> {
// Acquire queue lock
let mut p = self.pointers.lock();
if p.is_closed {
return Err(task);
}
// safety: only mutated with the lock held
let len = unsafe { self.len.unsync_l... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3b38ebd7f5d50611193f942c31c57262f263be33 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b38ebd7f5d50611193f942c31c57262f263be33/tokio/src/runtime/task/inject.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:4 | // Link up all the tasks.
let mut prev = first;
let mut counter = 1;
// We are going to be called with an `std::iter::Chain`, and that
// iterator overrides `for_each` to something that is easier for the
// compiler to optimize than a loop.
iter.map(|next| next.into_raw(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3b38ebd7f5d50611193f942c31c57262f263be33 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b38ebd7f5d50611193f942c31c57262f263be33/tokio/src/runtime/task/inject.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:5 | p.tail = Some(batch_tail);
// Increment the count.
//
// safety: All updates to the len atomic are guarded by the mutex. As
// such, a non-atomic load followed by a store is safe.
let len = unsafe { self.len.unsync_load() };
self.len.store(len + num, Release);
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3b38ebd7f5d50611193f942c31c57262f263be33 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b38ebd7f5d50611193f942c31c57262f263be33/tokio/src/runtime/task/inject.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/inject.rs:6 | Some(unsafe { task::Notified::from_raw(task) })
}
}
impl<T: 'static> Drop for Inject<T> {
fn drop(&mut self) {
if !std::thread::panicking() {
assert!(self.pop().is_none(), "queue not empty");
}
}
}
fn get_next(header: NonNull<task::Header>) -> Option<NonNull<task::Header>> {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/inject.rs | MIT | 3b38ebd7f5d50611193f942c31c57262f263be33 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b38ebd7f5d50611193f942c31c57262f263be33/tokio/src/runtime/task/inject.rs | 201 | 221 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:4 | /// Ok(())
/// }
///
/// ```
/// Child being detached and outliving its parent:
///
/// ```no_run
/// use tokio::task;
/// use tokio::time;
/// use std::time::Duration;
///
/// # #[tokio::main] async fn main() {
/// let original_task = task::spawn(async {
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 06f1a601bb05b1aba9f95020a7fa7572899c588f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06f1a601bb05b1aba9f95020a7fa7572899c588f/tokio/src/runtime/task/join.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:5 | unsafe impl<T: Send> Send for JoinHandle<T> {}
unsafe impl<T: Send> Sync for JoinHandle<T> {}
impl<T> UnwindSafe for JoinHandle<T> {}
impl<T> RefUnwindSafe for JoinHandle<T> {}
impl<T> JoinHandle<T> {
pub(super) fn new(raw: RawTask) -> JoinHandle<T> {
JoinHandle {
raw,
_p: PhantomD... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 06f1a601bb05b1aba9f95020a7fa7572899c588f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06f1a601bb05b1aba9f95020a7fa7572899c588f/tokio/src/runtime/task/join.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:6 | /// }
///
/// for handle in handles {
/// assert!(handle.await.unwrap_err().is_cancelled());
/// }
/// }
/// ```
/// [cancelled]: method@super::error::JoinError::is_cancelled
pub fn abort(&self) {
self.raw.remote_abort();
}
/// Checks if the task associat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 06f1a601bb05b1aba9f95020a7fa7572899c588f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06f1a601bb05b1aba9f95020a7fa7572899c588f/tokio/src/runtime/task/join.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | pub fn is_finished(&self) -> bool {
let state = self.raw.header().state.load();
state.is_complete()
}
/// Set the waker that is notified when the task completes.
pub(crate) fn set_join_waker(&mut self, waker: &Waker) {
if self.raw.try_set_join_waker(waker) {
// In this c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 06f1a601bb05b1aba9f95020a7fa7572899c588f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06f1a601bb05b1aba9f95020a7fa7572899c588f/tokio/src/runtime/task/join.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:8 | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let mut ret = Poll::Pending;
// Keep track of task budget
let coop = ready!(crate::runtime::coop::poll_proceed(cx));
// Try to read the task output. If the task is not yet complete, the
// waker is stor... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 06f1a601bb05b1aba9f95020a7fa7572899c588f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06f1a601bb05b1aba9f95020a7fa7572899c588f/tokio/src/runtime/task/join.rs | 281 | 332 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:9 | impl<T> fmt::Debug for JoinHandle<T>
where
T: fmt::Debug,
{
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
// Safety: The header pointer is valid.
let id_ptr = unsafe { Header::get_id_ptr(self.raw.header_ptr()) };
let id = unsafe { id_ptr.as_ref() };
fmt.debug_struc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 06f1a601bb05b1aba9f95020a7fa7572899c588f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06f1a601bb05b1aba9f95020a7fa7572899c588f/tokio/src/runtime/task/join.rs | 321 | 332 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:4 | /// Ok(())
/// }
///
/// ```
/// Child being detached and outliving its parent:
///
/// ```no_run
/// use tokio::task;
/// use tokio::time;
/// use std::time::Duration;
///
/// # #[tokio::main] async fn main() {
/// let original_task = task::spawn(async {
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 71bd49e146ac5288fd4cb327dd3f86eb71b3a865 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/join.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:5 | }
unsafe impl<T: Send> Send for JoinHandle<T> {}
unsafe impl<T: Send> Sync for JoinHandle<T> {}
impl<T> UnwindSafe for JoinHandle<T> {}
impl<T> RefUnwindSafe for JoinHandle<T> {}
impl<T> JoinHandle<T> {
pub(super) fn new(raw: RawTask, id: Id) -> JoinHandle<T> {
JoinHandle {
raw: Some(raw),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 71bd49e146ac5288fd4cb327dd3f86eb71b3a865 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/join.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:6 | /// for handle in &handles {
/// handle.abort();
/// }
///
/// for handle in handles {
/// assert!(handle.await.unwrap_err().is_cancelled());
/// }
/// }
/// ```
/// [cancelled]: method@super::error::JoinError::is_cancelled
pub fn abort(&self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 71bd49e146ac5288fd4cb327dd3f86eb71b3a865 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/join.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | /// assert!(handle2.is_finished());
/// # }
/// ```
/// [`abort`]: method@JoinHandle::abort
pub fn is_finished(&self) -> bool {
if let Some(raw) = self.raw {
let state = raw.header().state.load();
state.is_complete()
} else {
true
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 71bd49e146ac5288fd4cb327dd3f86eb71b3a865 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/join.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:8 | /// [unstable]: crate#unstable-features
#[cfg(tokio_unstable)]
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
pub fn id(&self) -> super::Id {
self.id
}
}
impl<T> Unpin for JoinHandle<T> {}
impl<T> Future for JoinHandle<T> {
type Output = super::Result<T>;
fn poll(self: Pin<&mut Self>, ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 71bd49e146ac5288fd4cb327dd3f86eb71b3a865 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/join.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:9 | if ret.is_ready() {
coop.made_progress();
}
ret
}
}
impl<T> Drop for JoinHandle<T> {
fn drop(&mut self) {
if let Some(raw) = self.raw.take() {
if raw.header().state.drop_join_handle_fast().is_ok() {
return;
}
raw.drop_joi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 71bd49e146ac5288fd4cb327dd3f86eb71b3a865 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/join.rs | 321 | 351 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | /// assert!(handle2.is_finished());
/// # }
/// ```
/// [`abort`]: method@JoinHandle::abort
pub fn is_finished(&self) -> bool {
if let Some(raw) = self.raw {
let state = raw.header().state.load();
state.is_complete()
} else {
true
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | a051ed726f3b99b077e8c9ef8ef1df2ab2943213 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a051ed726f3b99b077e8c9ef8ef1df2ab2943213/tokio/src/runtime/task/join.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:8 | /// [unstable]: crate#unstable-features
#[cfg(tokio_unstable)]
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
pub fn id(&self) -> super::Id {
self.id.clone()
}
}
impl<T> Unpin for JoinHandle<T> {}
impl<T> Future for JoinHandle<T> {
type Output = super::Result<T>;
fn poll(self: Pin<&mut... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | a051ed726f3b99b077e8c9ef8ef1df2ab2943213 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a051ed726f3b99b077e8c9ef8ef1df2ab2943213/tokio/src/runtime/task/join.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | /// assert!(handle2.is_finished());
/// # }
/// ```
/// [`abort`]: method@JoinHandle::abort
pub fn is_finished(&self) -> bool {
if let Some(raw) = self.raw {
let state = raw.header().state.load();
state.is_complete()
} else {
true
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | b248be2879dfc5e19d1b82561486efede74172ba | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b248be2879dfc5e19d1b82561486efede74172ba/tokio/src/runtime/task/join.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:8 | /// [unstable]: crate#unstable-features
#[cfg(tokio_unstable)]
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
pub fn id(&self) -> super::Id {
self.id.clone()
}
}
impl<T> Unpin for JoinHandle<T> {}
impl<T> Future for JoinHandle<T> {
type Output = super::Result<T>;
fn poll(self: Pin<&mut... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | b248be2879dfc5e19d1b82561486efede74172ba | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b248be2879dfc5e19d1b82561486efede74172ba/tokio/src/runtime/task/join.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:4 | ///
/// ```
/// Child being detached and outliving its parent:
///
/// ```no_run
/// use tokio::task;
/// use tokio::time;
/// use std::time::Duration;
///
/// # #[tokio::main] async fn main() {
/// let original_task = task::spawn(async {
/// let _detached_task = task::sp... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe/tokio/src/runtime/task/join.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:5 | unsafe impl<T: Send> Send for JoinHandle<T> {}
unsafe impl<T: Send> Sync for JoinHandle<T> {}
impl<T> UnwindSafe for JoinHandle<T> {}
impl<T> RefUnwindSafe for JoinHandle<T> {}
impl<T> JoinHandle<T> {
pub(super) fn new(raw: RawTask, id: Id) -> JoinHandle<T> {
JoinHandle {
raw: Some(raw),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe/tokio/src/runtime/task/join.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:6 | /// }
///
/// for handle in handles {
/// assert!(handle.await.unwrap_err().is_cancelled());
/// }
/// }
/// ```
/// [cancelled]: method@super::error::JoinError::is_cancelled
pub fn abort(&self) {
if let Some(raw) = self.raw {
raw.remote_abort();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe/tokio/src/runtime/task/join.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | /// ```
/// [`abort`]: method@JoinHandle::abort
pub fn is_finished(&self) -> bool {
if let Some(raw) = self.raw {
let state = raw.header().state.load();
state.is_complete()
} else {
true
}
}
/// Set the waker that is notified when the task com... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe/tokio/src/runtime/task/join.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:8 | #[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
pub fn id(&self) -> super::Id {
self.id.clone()
}
}
impl<T> Unpin for JoinHandle<T> {}
impl<T> Future for JoinHandle<T> {
type Output = super::Result<T>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let mut r... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe/tokio/src/runtime/task/join.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:9 | coop.made_progress();
}
ret
}
}
impl<T> Drop for JoinHandle<T> {
fn drop(&mut self) {
if let Some(raw) = self.raw.take() {
if raw.header().state.drop_join_handle_fast().is_ok() {
return;
}
raw.drop_join_handle_slow();
}
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe/tokio/src/runtime/task/join.rs | 321 | 349 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | /// ```
/// [`abort`]: method@JoinHandle::abort
pub fn is_finished(&self) -> bool {
if let Some(raw) = self.raw {
let state = raw.header().state.load();
state.is_complete()
} else {
true
}
}
/// Set the waker that is notified when the task com... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | bdbb0ece10e654b9e265364a6b39439d85bf7601 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bdbb0ece10e654b9e265364a6b39439d85bf7601/tokio/src/runtime/task/join.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:8 | #[cfg(tokio_unstable)]
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
pub fn id(&self) -> super::Id {
self.id.clone()
}
}
impl<T> Unpin for JoinHandle<T> {}
impl<T> Future for JoinHandle<T> {
type Output = super::Result<T>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | bdbb0ece10e654b9e265364a6b39439d85bf7601 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bdbb0ece10e654b9e265364a6b39439d85bf7601/tokio/src/runtime/task/join.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:4 | /// # #[tokio::main] async fn main() {
/// let original_task = task::spawn(async {
/// let _detached_task = task::spawn(async {
/// // Here we sleep to make sure that the first task returns before.
/// time::sleep(Duration::from_millis(10)).await;
/// // This will be call... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b/tokio/src/runtime/task/join.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:6 | if let Some(raw) = self.raw {
raw.remote_abort();
}
}
/// Checks if the task associated with this `JoinHandle` has finished.
///
/// Please note that this method can return `false` even if [`abort`] has been
/// called on the task. This is because the cancellation process may ta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b/tokio/src/runtime/task/join.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | }
/// Set the waker that is notified when the task completes.
pub(crate) fn set_join_waker(&mut self, waker: &Waker) {
if let Some(raw) = self.raw {
if raw.try_set_join_waker(waker) {
// In this case the task has already completed. We wake the waker immediately.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b/tokio/src/runtime/task/join.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:8 | impl<T> Future for JoinHandle<T> {
type Output = super::Result<T>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let mut ret = Poll::Pending;
// Keep track of task budget
let coop = ready!(crate::coop::poll_proceed(cx));
// Raw should always be se... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b/tokio/src/runtime/task/join.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:9 | fn drop(&mut self) {
if let Some(raw) = self.raw.take() {
if raw.header().state.drop_join_handle_fast().is_ok() {
return;
}
raw.drop_join_handle_slow();
}
}
}
impl<T> fmt::Debug for JoinHandle<T>
where
T: fmt::Debug,
{
fn fmt(&self, fmt: ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/83d0e7f8b3b207f8db57e75c7f7d2e384d26ec3b/tokio/src/runtime/task/join.rs | 321 | 341 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:5 | raw: Some(raw),
id,
_p: PhantomData,
}
}
/// Abort the task associated with the handle.
///
/// Awaiting a cancelled task might complete as usual if the task was
/// already completed at the time it was cancelled, but most likely it
/// will fail with a [cancelle... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/join.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:6 | if let Some(raw) = self.raw {
raw.remote_abort();
}
}
/// Set the waker that is notified when the task completes.
pub(crate) fn set_join_waker(&mut self, waker: &Waker) {
if let Some(raw) = self.raw {
if raw.try_set_join_waker(waker) {
// In this case... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/join.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | impl<T> Unpin for JoinHandle<T> {}
impl<T> Future for JoinHandle<T> {
type Output = super::Result<T>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let mut ret = Poll::Pending;
// Keep track of task budget
let coop = ready!(crate::coop::poll_proceed(cx));... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/join.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:8 | }
impl<T> Drop for JoinHandle<T> {
fn drop(&mut self) {
if let Some(raw) = self.raw.take() {
if raw.header().state.drop_join_handle_fast().is_ok() {
return;
}
raw.drop_join_handle_slow();
}
}
}
impl<T> fmt::Debug for JoinHandle<T>
where
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/join.rs | 281 | 304 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:4 | /// # #[tokio::main] async fn main() {
/// let original_task = task::spawn(async {
/// let _detached_task = task::spawn(async {
/// // Here we sleep to make sure that the first task returns before.
/// time::sleep(Duration::from_millis(10)).await;
/// // This will be call... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/join.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:5 | _p: PhantomData,
}
}
/// Abort the task associated with the handle.
///
/// Awaiting a cancelled task might complete as usual if the task was
/// already completed at the time it was cancelled, but most likely it
/// will fail with a [cancelled] `JoinError`.
///
/// ```rust
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/join.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:6 | }
}
/// Set the waker that is notified when the task completes.
pub(crate) fn set_join_waker(&mut self, waker: &Waker) {
if let Some(raw) = self.raw {
if raw.try_set_join_waker(waker) {
// In this case the task has already completed. We wake the waker immediately.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/join.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | .expect("polling after `JoinHandle` already completed");
// Try to read the task output. If the task is not yet complete, the
// waker is stored and is notified once the task does complete.
//
// The function must go via the vtable, which requires erasing generic
// types. To do... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 8e0e56fdf23da0ad807c78ac57a19db939666253 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/join.rs | 241 | 285 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:5 | _p: PhantomData,
}
}
/// Abort the task associated with the handle.
///
/// Awaiting a cancelled task might complete as usual if the task was
/// already completed at the time it was cancelled, but most likely it
/// will fail with a [cancelled] `JoinError`.
///
/// ```rust
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 1bb4d2316232a77d048e8797ba04d796911ffe30 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/join.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:6 | }
}
/// Set the waker that is notified when the task completes.
pub(crate) fn set_join_waker(&mut self, waker: &Waker) {
if let Some(raw) = self.raw {
if raw.try_set_join_waker(waker) {
// In this case the task has already completed. We wake the waker immediately.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 1bb4d2316232a77d048e8797ba04d796911ffe30 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/join.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | // Safety:
//
// The type of `T` must match the task's output type.
unsafe {
raw.try_read_output(&mut ret as *mut _ as *mut (), cx.waker());
}
if ret.is_ready() {
coop.made_progress();
}
ret
}
}
impl<T> Drop for JoinHandle<T> {
f... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 1bb4d2316232a77d048e8797ba04d796911ffe30 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/join.rs | 241 | 275 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:5 | _p: PhantomData,
}
}
/// Abort the task associated with the handle.
///
/// Awaiting a cancelled task might complete as usual if the task was
/// already completed at the time it was cancelled, but most likely it
/// will fail with a [cancelled] `JoinError`.
///
/// ```rust
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 9e38ebcaa957d5422a0946ae8536509fe0d76d94 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e38ebcaa957d5422a0946ae8536509fe0d76d94/tokio/src/runtime/task/join.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:6 | }
}
}
impl<T> Unpin for JoinHandle<T> {}
impl<T> Future for JoinHandle<T> {
type Output = super::Result<T>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let mut ret = Poll::Pending;
// Keep track of task budget
let coop = ready!(crate::coop::poll_pr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 9e38ebcaa957d5422a0946ae8536509fe0d76d94 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e38ebcaa957d5422a0946ae8536509fe0d76d94/tokio/src/runtime/task/join.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | ret
}
}
impl<T> Drop for JoinHandle<T> {
fn drop(&mut self) {
if let Some(raw) = self.raw.take() {
if raw.header().state.drop_join_handle_fast().is_ok() {
return;
}
raw.drop_join_handle_slow();
}
}
}
impl<T> fmt::Debug for JoinHandle<T>
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | 9e38ebcaa957d5422a0946ae8536509fe0d76d94 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e38ebcaa957d5422a0946ae8536509fe0d76d94/tokio/src/runtime/task/join.rs | 241 | 265 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:4 | /// let original_task = task::spawn(async {
/// let _detached_task = task::spawn(async {
/// // Here we sleep to make sure that the first task returns before.
/// time::sleep(Duration::from_millis(10)).await;
/// // This will be called, even though the JoinHandle is dropped.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | d9b2dc81ca2a145f6b5ca91ccd05f14dbfdfb8cd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9b2dc81ca2a145f6b5ca91ccd05f14dbfdfb8cd/tokio/src/runtime/task/join.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:5 | /// Abort the task associated with the handle.
///
/// Awaiting a cancelled task might complete as usual if the task was
/// already completed at the time it was cancelled, but most likely it
/// will fail with a [cancelled] `JoinError`.
///
/// ```rust
/// use tokio::time;
///
/// #... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | d9b2dc81ca2a145f6b5ca91ccd05f14dbfdfb8cd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9b2dc81ca2a145f6b5ca91ccd05f14dbfdfb8cd/tokio/src/runtime/task/join.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:6 | impl<T> Unpin for JoinHandle<T> {}
impl<T> Future for JoinHandle<T> {
type Output = super::Result<T>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let mut ret = Poll::Pending;
// Keep track of task budget
let coop = ready!(crate::coop::poll_proceed(cx));... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | d9b2dc81ca2a145f6b5ca91ccd05f14dbfdfb8cd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9b2dc81ca2a145f6b5ca91ccd05f14dbfdfb8cd/tokio/src/runtime/task/join.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:7 | impl<T> Drop for JoinHandle<T> {
fn drop(&mut self) {
if let Some(raw) = self.raw.take() {
if raw.header().state.drop_join_handle_fast().is_ok() {
return;
}
raw.drop_join_handle_slow();
}
}
}
impl<T> fmt::Debug for JoinHandle<T>
where
T: ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | d9b2dc81ca2a145f6b5ca91ccd05f14dbfdfb8cd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9b2dc81ca2a145f6b5ca91ccd05f14dbfdfb8cd/tokio/src/runtime/task/join.rs | 241 | 261 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:4 | /// let original_task = task::spawn(async {
/// let _detached_task = task::spawn(async {
/// // Here we sleep to make sure that the first task returns before.
/// time::sleep(Duration::from_millis(10)).await;
/// // This will be called, even though the JoinHandle is dropped.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/join.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:5 | /// Abort the task associated with the handle.
///
/// Awaiting a cancelled task might complete as usual if the task was
/// already completed at the time it was cancelled, but most likely it
/// will complete with a `Err(JoinError::Cancelled)`.
///
/// ```rust
/// use tokio::time;
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/join.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:6 | impl<T> Future for JoinHandle<T> {
type Output = super::Result<T>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let mut ret = Poll::Pending;
// Keep track of task budget
let coop = ready!(crate::coop::poll_proceed(cx));
// Raw should always be se... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/join.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:5 | /// Abort the task associated with the handle.
///
/// Awaiting a cancelled task might complete as usual if the task was
/// already completed at the time it was cancelled, but most likely it
/// will complete with a `Err(JoinError::Cancelled)`.
///
/// ```rust
/// use tokio::time;
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | c90681bd8e629b5fde988b9f5be7b915e5cf8ae5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c90681bd8e629b5fde988b9f5be7b915e5cf8ae5/tokio/src/runtime/task/join.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/join.rs:4 | /// let original_task = task::spawn(async {
/// let _detached_task = task::spawn(async {
/// // Here we sleep to make sure that the first task returns before.
/// time::delay_for(Duration::from_millis(10)).await;
/// // This will be called, even though the JoinHandle is dropp... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/join.rs | MIT | cbb14a7bb9a13363e1abee8caff2bad1f996c263 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cbb14a7bb9a13363e1abee8caff2bad1f996c263/tokio/src/runtime/task/join.rs | 121 | 180 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.