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:9
// Notify the join handle. The previous transition obtains the // lock on the waker cell. self.trailer().wake_join(); } })); // The task has completed execution and will no longer be scheduled. let num_release = self.release(); if self.state(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/harness.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:10
unsafe { Task::from_raw(self.cell.cast()) } } } fn can_read_output(header: &Header, trailer: &Trailer, waker: &Waker) -> bool { // Load a snapshot of the current task state let snapshot = header.state.load(); debug_assert!(snapshot.is_join_interested()); if !snapshot.is_complete() { // Th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/harness.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:11
} else { set_join_waker(header, trailer, waker.clone(), snapshot) }; match res { Ok(_) => return false, Err(snapshot) => { assert!(snapshot.is_complete()); } } } true } fn set_join_waker( header: &Header, trailer: ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/harness.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:12
} enum PollFuture { Complete, Notified, Done, Dealloc, } /// Cancels the task and store the appropriate error in the stage field. fn cancel_task<T: Future, S: Schedule>(core: &Core<T, S>) { // Drop the future from a panic guard. let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/harness.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:13
} let guard = Guard { core }; let res = guard.core.poll(cx); mem::forget(guard); res })); // Prepare output for being placed in the core stage. let output = match output { Ok(Poll::Pending) => return Poll::Pending, Ok(Poll::Ready(output)) => Ok(output), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
71bd49e146ac5288fd4cb327dd3f86eb71b3a865
github
async-runtime
https://github.com/tokio-rs/tokio/blob/71bd49e146ac5288fd4cb327dd3f86eb71b3a865/tokio/src/runtime/task/harness.rs
481
508
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:11
} else { set_join_waker(header, trailer, waker.clone(), snapshot) }; match res { Ok(_) => return false, Err(snapshot) => { assert!(snapshot.is_complete()); } } } true } fn set_join_waker( header: &Header, trailer: ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
9e3fb1673a73046363af64c09a040eeed67f2a4c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e3fb1673a73046363af64c09a040eeed67f2a4c/tokio/src/runtime/task/harness.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:12
} enum PollFuture { Complete, Notified, Done, Dealloc, } /// Cancels the task and store the appropriate error in the stage field. fn cancel_task<T: Future, S: Schedule>(core: &Core<T, S>) { // Drop the future from a panic guard. let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
9e3fb1673a73046363af64c09a040eeed67f2a4c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e3fb1673a73046363af64c09a040eeed67f2a4c/tokio/src/runtime/task/harness.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:13
} } let guard = Guard { core }; let res = guard.core.poll(cx); mem::forget(guard); res })); // Prepare output for being placed in the core stage. let output = match output { Ok(Poll::Pending) => return Poll::Pending, Ok(Poll::Ready(output)) => Ok(outp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
9e3fb1673a73046363af64c09a040eeed67f2a4c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e3fb1673a73046363af64c09a040eeed67f2a4c/tokio/src/runtime/task/harness.rs
481
509
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:1
use crate::future::Future; use crate::runtime::task::core::{Cell, Core, CoreStage, Header, Trailer}; use crate::runtime::task::state::{Snapshot, State}; use crate::runtime::task::waker::waker_ref; use crate::runtime::task::{JoinError, Notified, Schedule, Task}; use std::mem; use std::mem::ManuallyDrop; use std::panic;...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:3
PollFuture::Done => (), } } /// Polls the task and cancel it if necessary. This takes ownership of a /// ref-count. /// /// If the return value is Notified, the caller is given ownership of two /// ref-counts. /// /// If the return value is Complete, the caller is given ownershi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:4
TransitionToIdle::Ok => PollFuture::Done, TransitionToIdle::OkNotified => PollFuture::Notified, TransitionToIdle::OkDealloc => PollFuture::Dealloc, TransitionToIdle::Cancelled => { // The transition to idle failed because the task was ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:5
} pub(super) fn dealloc(self) { // Release the join waker, if there is one. self.trailer().waker.with_mut(drop); // Check causality self.core().stage.with_mut(drop); // Safety: The caller of this method just transitioned our ref-count to // zero, so it is our respo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:6
can_read_output(self.header(), self.trailer(), waker) } pub(super) fn drop_join_handle_slow(self) { // Try to unset `JOIN_INTEREST`. This must be done as a first step in // case the task concurrently completed. if self.state().unset_join_interested().is_err() { // It is our ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:7
self.core() .scheduler .schedule(Notified(self.get_new_task())); } } // ===== waker behavior ===== /// This call consumes a ref-count and notifies the task. This will create a /// new Notified and submit it if necessary. /// /// The caller does not need ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:8
/// This call notifies the task. It will not consume any ref-counts, but the /// caller should hold a ref-count. This will create a new Notified and /// submit it if necessary. pub(super) fn wake_by_ref(&self) { use super::state::TransitionToNotifiedByRef; match self.state().transition_to_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:9
// We catch panics here in case dropping the future or waking the // JoinHandle panics. let _ = panic::catch_unwind(panic::AssertUnwindSafe(|| { if !snapshot.is_join_interested() { // The `JoinHandle` is not interested in the output of // this task. It is our ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:10
/// # Safety /// /// Any use of `self` after this call must ensure that a ref-count to the /// task holds the task alive until after the use of `self`. Passing the /// returned Task to any method on `self` is unsound if dropping the Task /// could drop `self` before the call on `self` returned. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:11
// This requires two atomic operations, unsetting the bit and // then resetting it. If the task transitions to complete // concurrently to either one of those operations, then setting // the join waker fails and we proceed to reading the task // output. header...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:12
// If the state could not be updated, then clear the join waker if res.is_err() { unsafe { trailer.set_waker(None); } } res } enum PollFuture { Complete, Notified, Done, Dealloc, } /// Cancels the task and store the appropriate error in the stage field. fn canc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:13
id: super::Id, cx: Context<'_>, ) -> Poll<()> { // Poll the future. let output = panic::catch_unwind(panic::AssertUnwindSafe(|| { struct Guard<'a, T: Future> { core: &'a CoreStage<T>, } impl<'a, T: Future> Drop for Guard<'a, T> { fn drop(&mut self) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
909439c9f54d8c8d7050996d279504a58739c417
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909439c9f54d8c8d7050996d279504a58739c417/tokio/src/runtime/task/harness.rs
481
522
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:1
use crate::future::Future; use crate::runtime::task::core::{Cell, Core, CoreStage, Header, Trailer}; use crate::runtime::task::state::Snapshot; use crate::runtime::task::waker::waker_ref; use crate::runtime::task::{JoinError, Notified, Schedule, Task}; use std::mem; use std::mem::ManuallyDrop; use std::panic; use std:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:2
fn core(&self) -> &Core<T, S> { unsafe { &self.cell.as_ref().core } } } impl<T, S> Harness<T, S> where T: Future, S: Schedule, { /// Polls the inner future. A ref-count is consumed. /// /// All necessary state checks and transitions are performed. /// Panics raised while polling the...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:3
/// Polls the task and cancel it if necessary. This takes ownership of a /// ref-count. /// /// If the return value is Notified, the caller is given ownership of two /// ref-counts. /// /// If the return value is Complete, the caller is given ownership of a /// single ref-count, which should...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:4
// The transition to idle failed because the task was // cancelled during the poll. let core = self.core(); cancel_task(&core.stage, core.task_id.clone()); PollFuture::Complete } } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:5
self.trailer().waker.with_mut(drop); // Check causality self.core().stage.with_mut(drop); unsafe { drop(Box::from_raw(self.cell.as_ptr())); } } // ===== join handle ===== /// Read the task output into `dst`. pub(super) fn try_read_output(self, dst: &mut Po...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:6
self.core().stage.drop_future_or_output(); })); } // Drop the `JoinHandle` reference, possibly deallocating the task self.drop_reference(); } /// Remotely aborts the task. /// /// The caller should hold a ref-count, but we do not consume it. /// /// This is ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:7
TransitionToNotifiedByVal::Submit => { // The caller has given us a ref-count, and the transition has // created a new ref-count, so we now hold two. We turn the new // ref-count Notified and pass it to the call to `schedule`. // // The old...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:8
} } pub(super) fn drop_reference(self) { if self.header().state.ref_dec() { self.dealloc(); } } #[cfg(all(tokio_unstable, feature = "tracing"))] pub(super) fn id(&self) -> Option<&tracing::Id> { self.header().id.as_ref() } // ====== internal ====== ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:9
if self.header().state.transition_to_terminal(num_release) { self.dealloc(); } } /// Releases the task from the scheduler. Returns the number of ref-counts /// that should be decremented. fn release(&self) -> usize { // We don't actually increment the ref-count here, but the...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:10
debug_assert!(snapshot.is_join_interested()); if !snapshot.is_complete() { // The waker must be stored in the task struct. let res = if snapshot.has_join_waker() { // There already is a waker stored in the struct. If it matches // the provided waker, then there is no further...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:11
} } } true } fn set_join_waker( header: &Header, trailer: &Trailer, waker: Waker, snapshot: Snapshot, ) -> Result<Snapshot, Snapshot> { assert!(snapshot.is_join_interested()); assert!(!snapshot.has_join_waker()); // Safety: Only the `JoinHandle` may set the `waker` field. W...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:12
/// Cancels the task and store the appropriate error in the stage field. fn cancel_task<T: Future>(stage: &CoreStage<T>, id: super::Id) { // Drop the future from a panic guard. let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { stage.drop_future_or_output(); })); match res { Ok(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:13
mem::forget(guard); res })); // Prepare output for being placed in the core stage. let output = match output { Ok(Poll::Pending) => return Poll::Pending, Ok(Poll::Ready(output)) => Ok(output), Err(panic) => { scheduler.unhandled_panic(); Err(JoinError...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/src/runtime/task/harness.rs
481
505
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:3
/// Polls the task and cancel it if necessary. This takes ownership of a /// ref-count. /// /// If the return value is Notified, the caller is given ownership of two /// ref-counts. /// /// If the return value is Complete, the caller is given ownership of a /// single ref-count, which should...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/harness.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:4
} } } TransitionToRunning::Cancelled => { let core = self.core(); cancel_task(&core.stage, core.task_id.clone()); PollFuture::Complete } TransitionToRunning::Failed => PollFuture::Done, Transition...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/harness.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:5
unsafe { drop(Box::from_raw(self.cell.as_ptr())); } } // ===== join handle ===== /// Read the task output into `dst`. pub(super) fn try_read_output(self, dst: &mut Poll<super::Result<T::Output>>, waker: &Waker) { if can_read_output(self.header(), self.trailer(), waker) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/harness.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:6
self.drop_reference(); } /// Remotely aborts the task. /// /// The caller should hold a ref-count, but we do not consume it. /// /// This is similar to `shutdown` except that it asks the runtime to perform /// the shutdown. This is necessary to avoid the shutdown happening in the /// wr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/harness.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:7
// The old ref-count is retained for now to ensure that the task // is not dropped during the call to `schedule` if the call // drops the task it was given. self.core() .scheduler .schedule(Notified(self.get_new_task())); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/harness.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:8
self.dealloc(); } } #[cfg(all(tokio_unstable, feature = "tracing"))] pub(super) fn id(&self) -> Option<&tracing::Id> { self.header().id.as_ref() } // ====== internal ====== /// Completes the task. This method assumes that the state is RUNNING. fn complete(self) { /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/harness.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:9
/// Releases the task from the scheduler. Returns the number of ref-counts /// that should be decremented. fn release(&self) -> usize { // We don't actually increment the ref-count here, but the new task is // never destroyed, so that's ok. let me = ManuallyDrop::new(self.get_new_task())...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/harness.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:10
// There already is a waker stored in the struct. If it matches // the provided waker, then there is no further work to do. // Otherwise, the waker must be swapped. let will_wake = unsafe { // Safety: when `JOIN_INTEREST` is set, only `JOIN_HANDLE` // ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/harness.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:11
fn set_join_waker( header: &Header, trailer: &Trailer, waker: Waker, snapshot: Snapshot, ) -> Result<Snapshot, Snapshot> { assert!(snapshot.is_join_interested()); assert!(!snapshot.has_join_waker()); // Safety: Only the `JoinHandle` may set the `waker` field. When // `JOIN_INTEREST` is ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/harness.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:12
stage.drop_future_or_output(); })); match res { Ok(()) => { stage.store_output(Err(JoinError::cancelled(id))); } Err(panic) => { stage.store_output(Err(JoinError::panic(id, panic))); } } } /// Polls the future. If the future completes, the output is ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/harness.rs
441
488
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:3
/// Polls the task and cancel it if necessary. This takes ownership of a /// ref-count. /// /// If the return value is Notified, the caller is given ownership of two /// ref-counts. /// /// If the return value is Complete, the caller is given ownership of a /// single ref-count, which should...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/harness.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:4
} } TransitionToRunning::Cancelled => { cancel_task(&self.core().stage); PollFuture::Complete } TransitionToRunning::Failed => PollFuture::Done, TransitionToRunning::Dealloc => PollFuture::Dealloc, } } /// Forci...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/harness.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:5
} // ===== join handle ===== /// Read the task output into `dst`. pub(super) fn try_read_output(self, dst: &mut Poll<super::Result<T::Output>>, waker: &Waker) { if can_read_output(self.header(), self.trailer(), waker) { *dst = Poll::Ready(self.core().stage.take_output()); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/harness.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:6
/// Remotely aborts the task. /// /// The caller should hold a ref-count, but we do not consume it. /// /// This is similar to `shutdown` except that it asks the runtime to perform /// the shutdown. This is necessary to avoid the shutdown happening in the /// wrong thread for non-Send tasks. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/harness.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:7
self.core() .scheduler .schedule(Notified(self.get_new_task())); // Now that we have completed the call to schedule, we can // release our ref-count. self.drop_reference(); } TransitionToNotifiedByVal::Deall...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/harness.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:8
#[cfg(all(tokio_unstable, feature = "tracing"))] pub(super) fn id(&self) -> Option<&tracing::Id> { self.header().id.as_ref() } // ====== internal ====== /// Completes the task. This method assumes that the state is RUNNING. fn complete(self) { // The future has completed and its ou...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/harness.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:9
fn release(&self) -> usize { // We don't actually increment the ref-count here, but the new task is // never destroyed, so that's ok. let me = ManuallyDrop::new(self.get_new_task()); if let Some(task) = self.core().scheduler.release(&me) { mem::forget(task); 2 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/harness.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:10
let will_wake = unsafe { // Safety: when `JOIN_INTEREST` is set, only `JOIN_HANDLE` // may mutate the `waker` field. trailer.will_wake(waker) }; if will_wake { // The task is not complete **and** the waker is up to date, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/harness.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:11
trailer: &Trailer, waker: Waker, snapshot: Snapshot, ) -> Result<Snapshot, Snapshot> { assert!(snapshot.is_join_interested()); assert!(!snapshot.has_join_waker()); // Safety: Only the `JoinHandle` may set the `waker` field. When // `JOIN_INTEREST` is **not** set, nothing else will touch the fie...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/harness.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:12
match res { Ok(()) => { stage.store_output(Err(JoinError::cancelled())); } Err(panic) => { stage.store_output(Err(JoinError::panic(panic))); } } } /// Polls the future. If the future completes, the output is written to the /// stage field. fn poll_future<T: F...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/harness.rs
441
485
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:1
use crate::future::Future; use crate::runtime::task::core::{Cell, Core, CoreStage, Header, Trailer}; use crate::runtime::task::state::Snapshot; use crate::runtime::task::waker::waker_ref; use crate::runtime::task::{JoinError, Notified, Schedule, Task}; use std::mem; use std::mem::ManuallyDrop; use std::panic; use std:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:2
impl<T, S> Harness<T, S> where T: Future, S: Schedule, { /// Polls the inner future. A ref-count is consumed. /// /// All necessary state checks and transitions are performed. /// Panics raised while polling the future are handled. pub(super) fn poll(self) { // We pass our ref-count ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:3
/// ref-counts. /// /// If the return value is Complete, the caller is given ownership of a /// single ref-count, which should be passed on to `complete`. /// /// If the return value is Dealloc, then this call consumed the last /// ref-count and the caller should call `dealloc`. /// /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:4
} TransitionToRunning::Failed => PollFuture::Done, TransitionToRunning::Dealloc => PollFuture::Dealloc, } } /// Forcibly shuts down the task. /// /// Attempt to transition to `Running` in order to forcibly shutdown the /// task. If the task is currently running or in...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:5
pub(super) fn try_read_output(self, dst: &mut Poll<super::Result<T::Output>>, waker: &Waker) { if can_read_output(self.header(), self.trailer(), waker) { *dst = Poll::Ready(self.core().stage.take_output()); } } /// Try to set the waker notified when the task is complete. Returns tru...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:6
/// the shutdown. This is necessary to avoid the shutdown happening in the /// wrong thread for non-Send tasks. pub(super) fn remote_abort(self) { if self.header().state.transition_to_notified_and_cancel() { // The transition has created a new ref-count, which we turn into // a N...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:7
// release our ref-count. self.drop_reference(); } TransitionToNotifiedByVal::Dealloc => { self.dealloc(); } TransitionToNotifiedByVal::DoNothing => {} } } /// This call notifies the task. It will not consume any ref-counts...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:8
// ====== internal ====== /// Completes the task. This method assumes that the state is RUNNING. fn complete(self) { // The future has completed and its output has been written to the task // stage. We transition from running to complete. let snapshot = self.header().state.transition_t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:9
if let Some(task) = self.core().scheduler.release(&me) { mem::forget(task); 2 } else { 1 } } /// Creates a new task that holds its own ref-count. /// /// # Safety /// /// Any use of `self` after this call must ensure that a ref-count to the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:10
if will_wake { // The task is not complete **and** the waker is up to date, // there is nothing further that needs to be done. return false; } // Unset the `JOIN_WAKER` to gain mutable access to the `waker` // field then update the fie...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:11
assert!(!snapshot.has_join_waker()); // Safety: Only the `JoinHandle` may set the `waker` field. When // `JOIN_INTEREST` is **not** set, nothing else will touch the field. unsafe { trailer.set_waker(Some(waker)); } // Update the `JoinWaker` state accordingly let res = header.state.set_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:12
stage.store_output(Err(JoinError::panic(panic))); } } } /// Polls the future. If the future completes, the output is written to the /// stage field. fn poll_future<T: Future>(core: &CoreStage<T>, cx: Context<'_>) -> Poll<()> { // Poll the future. let output = panic::catch_unwind(panic::AssertUnwind...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/harness.rs
441
480
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:4
} TransitionToRunning::Failed => PollFuture::Done, TransitionToRunning::Dealloc => PollFuture::Dealloc, } } /// Forcibly shuts down the task. /// /// Attempt to transition to `Running` in order to forcibly shutdown the /// task. If the task is currently running or in...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
111dd66f3edc29d473c4741fa8829c123a70acb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/111dd66f3edc29d473c4741fa8829c123a70acb8/tokio/src/runtime/task/harness.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:5
pub(super) fn try_read_output(self, dst: &mut Poll<super::Result<T::Output>>, waker: &Waker) { if can_read_output(self.header(), self.trailer(), waker) { *dst = Poll::Ready(self.core().stage.take_output()); } } pub(super) fn drop_join_handle_slow(self) { // Try to unset `JOI...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
111dd66f3edc29d473c4741fa8829c123a70acb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/111dd66f3edc29d473c4741fa8829c123a70acb8/tokio/src/runtime/task/harness.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:6
// Since the caller holds a ref-count, the task cannot be destroyed // before the call to `schedule` returns even if the call drops the // `Notified` internally. self.core() .scheduler .schedule(Notified(self.get_new_task())); } } // =...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
111dd66f3edc29d473c4741fa8829c123a70acb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/111dd66f3edc29d473c4741fa8829c123a70acb8/tokio/src/runtime/task/harness.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:7
} } /// This call notifies the task. It will not consume any ref-counts, but the /// caller should hold a ref-count. This will create a new Notified and /// submit it if necessary. pub(super) fn wake_by_ref(&self) { use super::state::TransitionToNotifiedByRef; match self.header()....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
111dd66f3edc29d473c4741fa8829c123a70acb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/111dd66f3edc29d473c4741fa8829c123a70acb8/tokio/src/runtime/task/harness.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:8
let snapshot = self.header().state.transition_to_complete(); // We catch panics here in case dropping the future or waking the // JoinHandle panics. let _ = panic::catch_unwind(panic::AssertUnwindSafe(|| { if !snapshot.is_join_interested() { // The `JoinHandle` is no...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
111dd66f3edc29d473c4741fa8829c123a70acb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/111dd66f3edc29d473c4741fa8829c123a70acb8/tokio/src/runtime/task/harness.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:9
/// Creates a new task that holds its own ref-count. /// /// # Safety /// /// Any use of `self` after this call must ensure that a ref-count to the /// task holds the task alive until after the use of `self`. Passing the /// returned Task to any method on `self` is unsound if dropping the Task ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
111dd66f3edc29d473c4741fa8829c123a70acb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/111dd66f3edc29d473c4741fa8829c123a70acb8/tokio/src/runtime/task/harness.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:10
// Unset the `JOIN_WAKER` to gain mutable access to the `waker` // field then update the field with the new join worker. // // This requires two atomic operations, unsetting the bit and // then resetting it. If the task transitions to complete // concurrently ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
111dd66f3edc29d473c4741fa8829c123a70acb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/111dd66f3edc29d473c4741fa8829c123a70acb8/tokio/src/runtime/task/harness.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:11
// Update the `JoinWaker` state accordingly let res = header.state.set_join_waker(); // If the state could not be updated, then clear the join waker if res.is_err() { unsafe { trailer.set_waker(None); } } res } enum PollFuture { Complete, Notified, Done, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
111dd66f3edc29d473c4741fa8829c123a70acb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/111dd66f3edc29d473c4741fa8829c123a70acb8/tokio/src/runtime/task/harness.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:12
fn poll_future<T: Future>(core: &CoreStage<T>, cx: Context<'_>) -> Poll<()> { // Poll the future. let output = panic::catch_unwind(panic::AssertUnwindSafe(|| { struct Guard<'a, T: Future> { core: &'a CoreStage<T>, } impl<'a, T: Future> Drop for Guard<'a, T> { fn d...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
111dd66f3edc29d473c4741fa8829c123a70acb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/111dd66f3edc29d473c4741fa8829c123a70acb8/tokio/src/runtime/task/harness.rs
441
473
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:4
} TransitionToRunning::Failed => PollFuture::Done, TransitionToRunning::Dealloc => PollFuture::Dealloc, } } /// Forcibly shuts down the task. /// /// Attempt to transition to `Running` in order to forcibly shutdown the /// task. If the task is currently running or in...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/harness.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:5
pub(super) fn try_read_output(self, dst: &mut Poll<super::Result<T::Output>>, waker: &Waker) { if can_read_output(self.header(), self.trailer(), waker) { *dst = Poll::Ready(self.core().stage.take_output()); } } pub(super) fn drop_join_handle_slow(self) { let mut maybe_panic ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/harness.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:6
/// wrong thread for non-Send tasks. pub(super) fn remote_abort(self) { if self.header().state.transition_to_notified_and_cancel() { // The transition has created a new ref-count, which we turn into // a Notified and pass to the task. // // Since the caller ho...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/harness.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:7
self.drop_reference(); } TransitionToNotifiedByVal::Dealloc => { self.dealloc(); } TransitionToNotifiedByVal::DoNothing => {} } } /// This call notifies the task. It will not consume any ref-counts, but the /// caller should hold a ref...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/harness.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:8
// ====== internal ====== /// Completes the task. This method assumes that the state is RUNNING. fn complete(self) { // The future has completed and its output has been written to the task // stage. We transition from running to complete. let snapshot = self.header().state.transition_t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/harness.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:9
mem::forget(task); 2 } else { 1 } } /// Creates a new task that holds its own ref-count. /// /// # Safety /// /// Any use of `self` after this call must ensure that a ref-count to the /// task holds the task alive until after the use of `self`. Passin...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/harness.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:11
// Safety: Only the `JoinHandle` may set the `waker` field. When // `JOIN_INTEREST` is **not** set, nothing else will touch the field. unsafe { trailer.set_waker(Some(waker)); } // Update the `JoinWaker` state accordingly let res = header.state.set_join_waker(); // If the state could n...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/harness.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:12
} } } /// Polls the future. If the future completes, the output is written to the /// stage field. fn poll_future<T: Future>(core: &CoreStage<T>, cx: Context<'_>) -> Poll<()> { // Poll the future. let output = panic::catch_unwind(panic::AssertUnwindSafe(|| { struct Guard<'a, T: Future> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/harness.rs
441
479
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:1
use crate::future::Future; use crate::runtime::task::core::{Cell, Core, CoreStage, Header, Trailer}; use crate::runtime::task::state::Snapshot; use crate::runtime::task::waker::waker_ref; use crate::runtime::task::{JoinError, Notified, Schedule, Task}; use std::mem; use std::mem::ManuallyDrop; use std::panic; use std:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/harness.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:2
impl<T, S> Harness<T, S> where T: Future, S: Schedule, { /// Polls the inner future. A ref-count is consumed. /// /// All necessary state checks and transitions are performed. /// Panics raised while polling the future are handled. pub(super) fn poll(self) { // We pass our ref-count ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/harness.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:3
/// ref-counts. /// /// If the return value is Complete, the caller is given ownership of a /// single ref-count, which should be passed on to `complete`. /// /// If the return value is Dealloc, then this call consumed the last /// ref-count and the caller should call `dealloc`. /// /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/harness.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:4
} TransitionToRunning::Failed => PollFuture::Done, TransitionToRunning::Dealloc => PollFuture::Dealloc, } } /// Forcibly shutdown the task /// /// Attempt to transition to `Running` in order to forcibly shutdown the /// task. If the task is currently running or in a ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/harness.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:5
pub(super) fn try_read_output(self, dst: &mut Poll<super::Result<T::Output>>, waker: &Waker) { if can_read_output(self.header(), self.trailer(), waker) { *dst = Poll::Ready(self.core().stage.take_output()); } } pub(super) fn drop_join_handle_slow(self) { let mut maybe_panic ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/harness.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:7
self.drop_reference(); } TransitionToNotifiedByVal::Dealloc => { self.dealloc(); } TransitionToNotifiedByVal::DoNothing => {} } } /// This call notifies the task. It will not consume any ref-counts, but the /// caller should hold a ref...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/harness.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:8
// ====== internal ====== /// Complete the task. This method assumes that the state is RUNNING. fn complete(self) { // The future has completed and its output has been written to the task // stage. We transition from running to complete. let snapshot = self.header().state.transition_to...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/harness.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:9
mem::forget(task); 2 } else { 1 } } /// Create a new task that holds its own ref-count. /// /// # Safety /// /// Any use of `self` after this call must ensure that a ref-count to the /// task holds the task alive until after the use of `self`. Passing...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/harness.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:11
// Safety: Only the `JoinHandle` may set the `waker` field. When // `JOIN_INTEREST` is **not** set, nothing else will touch the field. unsafe { trailer.set_waker(Some(waker)); } // Update the `JoinWaker` state accordingly let res = header.state.set_join_waker(); // If the state could n...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/harness.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:12
} } } /// Poll the future. If the future completes, the output is written to the /// stage field. fn poll_future<T: Future>(core: &CoreStage<T>, cx: Context<'_>) -> Poll<()> { // Poll the future. let output = panic::catch_unwind(panic::AssertUnwindSafe(|| { struct Guard<'a, T: Future> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
b501f25202aba8f50c1ded4204f0129939fabc79
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/harness.rs
441
479
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:1
use crate::future::Future; use crate::runtime::task::core::{Cell, Core, CoreStage, Header, Trailer}; use crate::runtime::task::state::Snapshot; use crate::runtime::task::waker::waker_ref; use crate::runtime::task::{JoinError, Notified, Schedule, Task}; use std::mem; use std::panic; use std::ptr::NonNull; use std::task...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/src/runtime/task/harness.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:2
SchedulerView { header: self.header(), scheduler: &self.core().scheduler, } } } impl<T, S> Harness<T, S> where T: Future, S: Schedule, { /// Polls the inner future. /// /// All necessary state checks and transitions are performed. /// /// Panics raised wh...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/src/runtime/task/harness.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:3
}; // The transition to `Running` done above ensures that a lock on the // future has been obtained. This also ensures the `*mut T` pointer // contains the future (as opposed to the output) and is initialized. let waker_ref = waker_ref::<T, S>(self.header()); let cx = Context::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/src/runtime/task/harness.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:4
// the scheduler or `JoinHandle`. i.e. if the output remains in the // task structure until the task is deallocated, it may be dropped // by a Waker on any arbitrary thread. let panic = panic::catch_unwind(panic::AssertUnwindSafe(|| { self.core().stage.drop_future_or_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/src/runtime/task/harness.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:5
self.header().id.as_ref() } /// Forcibly shutdown the task /// /// Attempt to transition to `Running` in order to forcibly shutdown the /// task. If the task is currently running or in a state of completion, then /// there is nothing further to do. When the task completes running, it will /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/src/runtime/task/harness.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:6
if is_join_interested { // Store the output. The future has already been dropped // // Safety: Mutual exclusion is obtained by having transitioned the task // state -> Running let stage = &self.core().stage; stage.store_outp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/src/runtime/task/harness.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:7
} impl<'a, S> SchedulerView<'a, S> where S: Schedule, { fn to_task(&self) -> Task<S> { // SAFETY The header is from the same struct containing the scheduler `S` so the cast is safe unsafe { Task::from_raw(self.header.into()) } } /// Returns true if the task should be deallocated. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/src/runtime/task/harness.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/harness.rs:8
Err(_) => { // The task was shutdown while in the run queue. At this point, // we just hold a ref counted reference. Since we do not have access to it here // return `DropReference` so the caller drops it. return TransitionToRunning::DropReference; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/harness.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/src/runtime/task/harness.rs
281
340