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/state.rs:1 | use crate::loom::sync::atomic::AtomicUsize;
use std::fmt;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Release};
use std::usize;
pub(super) struct State {
val: AtomicUsize,
}
/// Current state value.
#[derive(Copy, Clone)]
pub(super) struct Snapshot(usize);
type UpdateResult = Result<Snapshot, Snapshot>;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/src/runtime/task/state.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:2 | const STATE_MASK: usize = LIFECYCLE_MASK | NOTIFIED | JOIN_INTEREST | JOIN_WAKER | CANCELLED;
/// Bits used by the ref count portion of the state.
const REF_COUNT_MASK: usize = !STATE_MASK;
/// Number of positions to shift the ref count.
const REF_COUNT_SHIFT: usize = REF_COUNT_MASK.count_zeros() as usize;
/// One r... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/src/runtime/task/state.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:1 | use crate::loom::sync::atomic::AtomicUsize;
use std::fmt;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Release};
use std::usize;
pub(super) struct State {
val: AtomicUsize,
}
/// Current state value.
#[derive(Copy, Clone)]
pub(super) struct Snapshot(usize);
type UpdateResult = Result<Snapshot, Snapshot>;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:2 | const CANCELLED: usize = 0b100_000;
/// All bits.
const STATE_MASK: usize = LIFECYCLE_MASK | NOTIFIED | JOIN_INTEREST | JOIN_WAKER | CANCELLED;
/// Bits used by the ref count portion of the state.
const REF_COUNT_MASK: usize = !STATE_MASK;
/// Number of positions to shift the ref count.
const REF_COUNT_SHIFT: usize ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:3 | }
#[must_use]
pub(super) enum TransitionToNotifiedByVal {
DoNothing,
Submit,
Dealloc,
}
#[must_use]
pub(crate) enum TransitionToNotifiedByRef {
DoNothing,
Submit,
}
/// All transitions are performed via RMW operations. This establishes an
/// unambiguous modification order.
impl State {
/// R... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:4 | // This happens if the task is either currently running or if it
// has already completed, e.g. if it was cancelled during
// shutdown. Consume the ref-count and return.
next.ref_dec();
if next.ref_count() == 0 {
action = TransitionToRu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:5 | if !next.is_notified() {
// Polling the future consumes the ref-count of the Notified.
next.ref_dec();
if next.ref_count() == 0 {
action = TransitionToIdle::OkDealloc;
} else {
action = TransitionToIdle::Ok;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:6 | "current: {}, sub: {}",
prev.ref_count(),
count
);
prev.ref_count() == count
}
/// Transitions the state to `NOTIFIED`.
///
/// If no task needs to be submitted, a ref-count is consumed.
///
/// If a task needs to be submitted, the ref-count is incremente... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7 | // retains ownership of the ref-count they passed in.
snapshot.set_notified();
snapshot.ref_inc();
action = TransitionToNotifiedByVal::Submit;
}
(action, Some(snapshot))
})
}
/// Transitions the state to `NOTIFIED`.
pub(super)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8 | feature = "rt",
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(super) fn transition_to_notified_for_tracing(&self) -> bool {
self.fetch_update_action(|mut snapshot| {
if snapshot.is_notified() {
(false, N... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9 | snapshot.set_cancelled();
if !snapshot.is_notified() {
snapshot.set_notified();
snapshot.ref_inc();
(true, Some(snapshot))
} else {
(false, Some(snapshot))
}
}
})
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10 | // Relaxed is acceptable as if this function is called and succeeds,
// then nothing has been done w/ the join handle.
//
// The moment the join handle is used (polled), the `JOIN_WAKER` flag is
// set, at which point the CAS will fail.
//
// Given this, there is no risk ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11 | /// the task has completed.
pub(super) fn set_join_waker(&self) -> UpdateResult {
self.fetch_update(|curr| {
assert!(curr.is_join_interested());
assert!(!curr.is_join_waker_set());
if curr.is_complete() {
return None;
}
let mut ne... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:12 | // Using a relaxed ordering is alright here, as knowledge of the
// original reference prevents other threads from erroneously deleting
// the object.
//
// As explained in the [Boost documentation][1], Increasing the
// reference counter can always be done with memory_order_rela... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:13 | loop {
let (output, next) = f(curr);
let next = match next {
Some(next) => next,
None => return output,
};
let res = self.val.compare_exchange(curr.0, next.0, AcqRel, Acquire);
match res {
Ok(_) => return outpu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:14 | impl Snapshot {
/// Returns `true` if the task is in an idle state.
pub(super) fn is_idle(self) -> bool {
self.0 & (RUNNING | COMPLETE) == 0
}
/// Returns `true` if the task has been flagged as notified.
pub(super) fn is_notified(self) -> bool {
self.0 & NOTIFIED == NOTIFIED
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:15 | pub(super) fn is_complete(self) -> bool {
self.0 & COMPLETE == COMPLETE
}
pub(super) fn is_join_interested(self) -> bool {
self.0 & JOIN_INTEREST == JOIN_INTEREST
}
fn unset_join_interested(&mut self) {
self.0 &= !JOIN_INTEREST;
}
pub(super) fn is_join_waker_set(self) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 561 | 619 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:16 | fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let snapshot = self.load();
snapshot.fmt(fmt)
}
}
impl fmt::Debug for Snapshot {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Snapshot")
.field("is_running", &self.is_running())
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d561b5850ad95f08505630ecae05f7a8e1d09eea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d561b5850ad95f08505630ecae05f7a8e1d09eea/tokio/src/runtime/task/state.rs | 601 | 619 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7 | // retains ownership of the ref-count they passed in.
snapshot.set_notified();
snapshot.ref_inc();
action = TransitionToNotifiedByVal::Submit;
}
(action, Some(snapshot))
})
}
/// Transitions the state to `NOTIFIED`.
pub(super)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/state.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8 | pub(super) fn transition_to_notified_for_tracing(&self) {
self.fetch_update_action(|mut snapshot| {
snapshot.set_notified();
snapshot.ref_inc();
((), Some(snapshot))
});
}
/// Sets the cancelled bit and transitions the state to `NOTIFIED` if idle.
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/state.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9 | }
})
}
/// Sets the `CANCELLED` bit and attempts to transition to `Running`.
///
/// Returns `true` if the transition to `Running` succeeded.
pub(super) fn transition_to_shutdown(&self) -> bool {
let mut prev = Snapshot(0);
let _ = self.fetch_update(|mut snapshot| {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/state.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10 | .compare_exchange_weak(
INITIAL_STATE,
(INITIAL_STATE - REF_ONE) & !JOIN_INTEREST,
Release,
Relaxed,
)
.map(|_| ())
.map_err(|_| ())
}
/// Tries to unset the `JOIN_INTEREST` flag.
///
/// Returns `Ok` if... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/state.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11 | }
let mut next = curr;
next.set_join_waker();
Some(next)
})
}
/// Unsets the `JOIN_WAKER` bit.
///
/// Returns `Ok` has been unset, `Err` otherwise. This operation fails if
/// the task has completed.
pub(super) fn unset_waker(&self) -> UpdateResult... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/state.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:12 | // reference, and passing an existing reference from one thread to
// another must already provide any required synchronization.
//
// [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
let prev = self.val.fetch_add(REF_ONE, Relaxed);
// If the reference co... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/state.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:13 | match res {
Ok(_) => return output,
Err(actual) => curr = Snapshot(actual),
}
}
}
fn fetch_update<F>(&self, mut f: F) -> Result<Snapshot, Snapshot>
where
F: FnMut(Snapshot) -> Option<Snapshot>,
{
let mut curr = self.load();
lo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/state.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:14 | self.0 & NOTIFIED == NOTIFIED
}
fn unset_notified(&mut self) {
self.0 &= !NOTIFIED;
}
fn set_notified(&mut self) {
self.0 |= NOTIFIED;
}
pub(super) fn is_running(self) -> bool {
self.0 & RUNNING == RUNNING
}
fn set_running(&mut self) {
self.0 |= RUNNIN... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/state.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:15 | fn unset_join_interested(&mut self) {
self.0 &= !JOIN_INTEREST;
}
pub(super) fn is_join_waker_set(self) -> bool {
self.0 & JOIN_WAKER == JOIN_WAKER
}
fn set_join_waker(&mut self) {
self.0 |= JOIN_WAKER;
}
fn unset_join_waker(&mut self) {
self.0 &= !JOIN_WAKER;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/state.rs | 561 | 611 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:16 | fmt.debug_struct("Snapshot")
.field("is_running", &self.is_running())
.field("is_complete", &self.is_complete())
.field("is_notified", &self.is_notified())
.field("is_cancelled", &self.is_cancelled())
.field("is_join_interested", &self.is_join_interested())
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/task/state.rs | 601 | 611 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9 | }
})
}
/// Sets the `CANCELLED` bit and attempts to transition to `Running`.
///
/// Returns `true` if the transition to `Running` succeeded.
pub(super) fn transition_to_shutdown(&self) -> bool {
let mut prev = Snapshot(0);
let _ = self.fetch_update(|mut snapshot| {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/state.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10 | .compare_exchange_weak(
INITIAL_STATE,
(INITIAL_STATE - REF_ONE) & !JOIN_INTEREST,
Release,
Relaxed,
)
.map(|_| ())
.map_err(|_| ())
}
/// Tries to unset the JOIN_INTEREST flag.
///
/// Returns `Ok` if t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/state.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:13 | match res {
Ok(_) => return output,
Err(actual) => curr = Snapshot(actual),
}
}
}
fn fetch_update<F>(&self, mut f: F) -> Result<Snapshot, Snapshot>
where
F: FnMut(Snapshot) -> Option<Snapshot>,
{
let mut curr = self.load();
lo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/state.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:14 | self.0 & NOTIFIED == NOTIFIED
}
fn unset_notified(&mut self) {
self.0 &= !NOTIFIED
}
fn set_notified(&mut self) {
self.0 |= NOTIFIED
}
pub(super) fn is_running(self) -> bool {
self.0 & RUNNING == RUNNING
}
fn set_running(&mut self) {
self.0 |= RUNNING;... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/state.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:15 | fn unset_join_interested(&mut self) {
self.0 &= !JOIN_INTEREST
}
pub(super) fn is_join_waker_set(self) -> bool {
self.0 & JOIN_WAKER == JOIN_WAKER
}
fn set_join_waker(&mut self) {
self.0 |= JOIN_WAKER;
}
fn unset_join_waker(&mut self) {
self.0 &= !JOIN_WAKER
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/state.rs | 561 | 611 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:2 | const CANCELLED: usize = 0b100_000;
/// All bits.
const STATE_MASK: usize = LIFECYCLE_MASK | NOTIFIED | JOIN_INTEREST | JOIN_WAKER | CANCELLED;
/// Bits used by the ref count portion of the state.
const REF_COUNT_MASK: usize = !STATE_MASK;
/// Number of positions to shift the ref count.
const REF_COUNT_SHIFT: usize ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d9e0f6611351be6ec02fa95bfcd9fef710714eaf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9e0f6611351be6ec02fa95bfcd9fef710714eaf/tokio/src/runtime/task/state.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:3 | }
#[must_use]
pub(super) enum TransitionToNotifiedByVal {
DoNothing,
Submit,
Dealloc,
}
#[must_use]
pub(super) enum TransitionToNotifiedByRef {
DoNothing,
Submit,
}
/// All transitions are performed via RMW operations. This establishes an
/// unambiguous modification order.
impl State {
/// R... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d9e0f6611351be6ec02fa95bfcd9fef710714eaf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9e0f6611351be6ec02fa95bfcd9fef710714eaf/tokio/src/runtime/task/state.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7 | // retains ownership of the ref-count they passed in.
snapshot.set_notified();
snapshot.ref_inc();
action = TransitionToNotifiedByVal::Submit;
}
(action, Some(snapshot))
})
}
/// Transitions the state to `NOTIFIED`.
pub(super)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d9e0f6611351be6ec02fa95bfcd9fef710714eaf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9e0f6611351be6ec02fa95bfcd9fef710714eaf/tokio/src/runtime/task/state.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8 | (false, None)
} else if snapshot.is_running() {
// If the task is running, we mark it as cancelled. The thread
// running the task will notice the cancelled bit when it
// stops polling and it will kill the task.
//
// The set_n... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d9e0f6611351be6ec02fa95bfcd9fef710714eaf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9e0f6611351be6ec02fa95bfcd9fef710714eaf/tokio/src/runtime/task/state.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9 | // If the task was not idle, the thread currently running the task
// will notice the cancelled bit and cancel it once the poll
// completes.
snapshot.set_cancelled();
Some(snapshot)
});
prev.is_idle()
}
/// Optimistically tries to swap the state... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d9e0f6611351be6ec02fa95bfcd9fef710714eaf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9e0f6611351be6ec02fa95bfcd9fef710714eaf/tokio/src/runtime/task/state.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10 | assert!(curr.is_join_interested());
if curr.is_complete() {
return None;
}
let mut next = curr;
next.unset_join_interested();
Some(next)
})
}
/// Sets the `JOIN_WAKER` bit.
///
/// Returns `Ok` if the bit is set, `Er... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d9e0f6611351be6ec02fa95bfcd9fef710714eaf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9e0f6611351be6ec02fa95bfcd9fef710714eaf/tokio/src/runtime/task/state.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11 | assert!(curr.is_join_waker_set());
if curr.is_complete() {
return None;
}
let mut next = curr;
next.unset_join_waker();
Some(next)
})
}
pub(super) fn ref_inc(&self) {
use std::process;
use std::sync::atomic::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d9e0f6611351be6ec02fa95bfcd9fef710714eaf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9e0f6611351be6ec02fa95bfcd9fef710714eaf/tokio/src/runtime/task/state.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:12 | prev.ref_count() == 1
}
/// Returns `true` if the task should be released.
pub(super) fn ref_dec_twice(&self) -> bool {
let prev = Snapshot(self.val.fetch_sub(2 * REF_ONE, AcqRel));
assert!(prev.ref_count() >= 2);
prev.ref_count() == 2
}
fn fetch_update_action<F, T>(&self, ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d9e0f6611351be6ec02fa95bfcd9fef710714eaf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9e0f6611351be6ec02fa95bfcd9fef710714eaf/tokio/src/runtime/task/state.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:13 | Some(next) => next,
None => return Err(curr),
};
let res = self.val.compare_exchange(curr.0, next.0, AcqRel, Acquire);
match res {
Ok(_) => return Ok(next),
Err(actual) => curr = Snapshot(actual),
}
}
}
}
// =... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d9e0f6611351be6ec02fa95bfcd9fef710714eaf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9e0f6611351be6ec02fa95bfcd9fef710714eaf/tokio/src/runtime/task/state.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:14 | self.0 |= RUNNING;
}
fn unset_running(&mut self) {
self.0 &= !RUNNING;
}
pub(super) fn is_cancelled(self) -> bool {
self.0 & CANCELLED == CANCELLED
}
fn set_cancelled(&mut self) {
self.0 |= CANCELLED;
}
/// Returns `true` if the task's future has completed exe... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d9e0f6611351be6ec02fa95bfcd9fef710714eaf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9e0f6611351be6ec02fa95bfcd9fef710714eaf/tokio/src/runtime/task/state.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:15 | pub(super) fn ref_count(self) -> usize {
(self.0 & REF_COUNT_MASK) >> REF_COUNT_SHIFT
}
fn ref_inc(&mut self) {
assert!(self.0 <= isize::MAX as usize);
self.0 += REF_ONE;
}
pub(super) fn ref_dec(&mut self) {
assert!(self.ref_count() > 0);
self.0 -= REF_ONE
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d9e0f6611351be6ec02fa95bfcd9fef710714eaf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d9e0f6611351be6ec02fa95bfcd9fef710714eaf/tokio/src/runtime/task/state.rs | 561 | 595 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10 | assert!(curr.is_join_interested());
if curr.is_complete() {
return None;
}
let mut next = curr;
next.unset_join_interested();
Some(next)
})
}
/// Sets the `JOIN_WAKER` bit.
///
/// Returns `Ok` if the bit is set, `Er... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/state.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11 | assert!(curr.has_join_waker());
if curr.is_complete() {
return None;
}
let mut next = curr;
next.unset_join_waker();
Some(next)
})
}
pub(super) fn ref_inc(&self) {
use std::process;
use std::sync::atomic::Ord... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/state.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:14 | self.0 |= RUNNING;
}
fn unset_running(&mut self) {
self.0 &= !RUNNING;
}
pub(super) fn is_cancelled(self) -> bool {
self.0 & CANCELLED == CANCELLED
}
fn set_cancelled(&mut self) {
self.0 |= CANCELLED;
}
/// Returns `true` if the task's future has completed exe... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/state.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:15 | pub(super) fn ref_count(self) -> usize {
(self.0 & REF_COUNT_MASK) >> REF_COUNT_SHIFT
}
fn ref_inc(&mut self) {
assert!(self.0 <= isize::MAX as usize);
self.0 += REF_ONE;
}
pub(super) fn ref_dec(&mut self) {
assert!(self.ref_count() > 0);
self.0 -= REF_ONE
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/state.rs | 561 | 595 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:1 | use crate::loom::sync::atomic::AtomicUsize;
use std::fmt;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Release};
use std::usize;
pub(super) struct State {
val: AtomicUsize,
}
/// Current state value
#[derive(Copy, Clone)]
pub(super) struct Snapshot(usize);
type UpdateResult = Result<Snapshot, Snapshot>;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/state.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:2 | const CANCELLED: usize = 0b100_000;
/// All bits
const STATE_MASK: usize = LIFECYCLE_MASK | NOTIFIED | JOIN_INTEREST | JOIN_WAKER | CANCELLED;
/// Bits used by the ref count portion of the state.
const REF_COUNT_MASK: usize = !STATE_MASK;
/// Number of positions to shift the ref count
const REF_COUNT_SHIFT: usize = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/state.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:3 | }
#[must_use]
pub(super) enum TransitionToNotifiedByVal {
DoNothing,
Submit,
Dealloc,
}
#[must_use]
pub(super) enum TransitionToNotifiedByRef {
DoNothing,
Submit,
}
/// All transitions are performed via RMW operations. This establishes an
/// unambiguous modification order.
impl State {
/// R... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/state.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:5 | if !next.is_notified() {
// Polling the future consumes the ref-count of the Notified.
next.ref_dec();
if next.ref_count() == 0 {
action = TransitionToIdle::OkDealloc;
} else {
action = TransitionToIdle::Ok;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/state.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7 | // retains ownership of the ref-count they passed in.
snapshot.set_notified();
snapshot.ref_inc();
action = TransitionToNotifiedByVal::Submit;
}
(action, Some(snapshot))
})
}
/// Transitions the state to `NOTIFIED`.
pub(super)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/state.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8 | (false, None)
} else if snapshot.is_running() {
// If the task is running, we mark it as cancelled. The thread
// running the task will notice the cancelled bit when it
// stops polling and it will kill the task.
//
// The set_n... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/state.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9 | // If the task was not idle, the thread currently running the task
// will notice the cancelled bit and cancel it once the poll
// completes.
snapshot.set_cancelled();
Some(snapshot)
});
prev.is_idle()
}
/// Optimistically tries to swap the state... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/state.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10 | assert!(curr.is_join_interested());
if curr.is_complete() {
return None;
}
let mut next = curr;
next.unset_join_interested();
Some(next)
})
}
/// Set the `JOIN_WAKER` bit.
///
/// Returns `Ok` if the bit is set, `Err... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/state.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:2 | const CANCELLED: usize = 0b100_000;
/// All bits
const STATE_MASK: usize = LIFECYCLE_MASK | NOTIFIED | JOIN_INTEREST | JOIN_WAKER | CANCELLED;
/// Bits used by the ref count portion of the state.
const REF_COUNT_MASK: usize = !STATE_MASK;
/// Number of positions to shift the ref count
const REF_COUNT_SHIFT: usize = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/state.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:3 | Snapshot(self.val.load(Acquire))
}
/// Attempt to transition the lifecycle to `Running`.
///
/// The `NOTIFIED` bit is always unset.
pub(super) fn transition_to_running(&self) -> UpdateResult {
self.fetch_update(|curr| {
assert!(curr.is_notified());
let mut next = c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/state.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:4 | if next.is_notified() {
// The caller needs to schedule the task. To do this, it needs a
// waker. The waker requires a ref count.
next.ref_inc();
}
Some(next)
})
}
/// Transitions the task from `Running` -> `Complete`.
pub(su... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/state.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:5 | snapshot.ref_dec();
}
Some(snapshot)
})
.unwrap()
}
/// Transitions the state to `NOTIFIED`.
///
/// Returns `true` if the task needs to be submitted to the pool for
/// execution
pub(super) fn transition_to_notified(&self) -> bool {
let prev = S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/state.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:6 | // in the run queue and is considered owned by the scheduler.
// The shutdown operation claims ownership of the task, which
// means we need to assign an additional ref-count to the task
// in the queue.
snapshot.ref_inc();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/state.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7 | /// Returns `Ok` if the operation happens before the task transitions to a
/// completed state, `Err` otherwise.
pub(super) fn unset_join_interested(&self) -> UpdateResult {
self.fetch_update(|curr| {
assert!(curr.is_join_interested());
if curr.is_complete() {
re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/state.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8 | /// the task has completed.
pub(super) fn unset_waker(&self) -> UpdateResult {
self.fetch_update(|curr| {
assert!(curr.is_join_interested());
assert!(curr.has_join_waker());
if curr.is_complete() {
return None;
}
let mut next = cu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/state.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9 | /// Returns `true` if the task should be released.
pub(super) fn ref_dec(&self) -> bool {
let prev = Snapshot(self.val.fetch_sub(REF_ONE, AcqRel));
prev.ref_count() == 1
}
/// Returns `true` if the task should be released.
pub(super) fn ref_dec_twice(&self) -> bool {
let prev = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/state.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10 | }
/// Returns `true` if the task has been flagged as notified.
pub(super) fn is_notified(self) -> bool {
self.0 & NOTIFIED == NOTIFIED
}
fn unset_notified(&mut self) {
self.0 &= !NOTIFIED
}
pub(super) fn is_running(self) -> bool {
self.0 & RUNNING == RUNNING
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/state.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11 | pub(super) fn is_join_interested(self) -> bool {
self.0 & JOIN_INTEREST == JOIN_INTEREST
}
fn unset_join_interested(&mut self) {
self.0 &= !JOIN_INTEREST
}
pub(super) fn has_join_waker(self) -> bool {
self.0 & JOIN_WAKER == JOIN_WAKER
}
fn set_join_waker(&mut self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/state.rs | 401 | 459 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:12 | fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let snapshot = self.load();
snapshot.fmt(fmt)
}
}
impl fmt::Debug for Snapshot {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Snapshot")
.field("is_running", &self.is_running())
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/state.rs | 441 | 459 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8 | /// the task has completed.
pub(super) fn unset_waker(&self) -> UpdateResult {
self.fetch_update(|curr| {
assert!(curr.is_join_interested());
assert!(curr.has_join_waker());
if curr.is_complete() {
return None;
}
let mut next = cu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/state.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9 | /// Returns `true` if the task should be released.
pub(super) fn ref_dec(&self) -> bool {
let prev = Snapshot(self.val.fetch_sub(REF_ONE, AcqRel));
prev.ref_count() == 1
}
fn fetch_update<F>(&self, mut f: F) -> Result<Snapshot, Snapshot>
where
F: FnMut(Snapshot) -> Option<Snapsh... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/state.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10 | fn unset_notified(&mut self) {
self.0 &= !NOTIFIED
}
pub(super) fn is_running(self) -> bool {
self.0 & RUNNING == RUNNING
}
fn set_running(&mut self) {
self.0 |= RUNNING;
}
fn unset_running(&mut self) {
self.0 &= !RUNNING;
}
pub(super) fn is_cancelled(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/state.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11 | }
pub(super) fn has_join_waker(self) -> bool {
self.0 & JOIN_WAKER == JOIN_WAKER
}
fn set_join_waker(&mut self) {
self.0 |= JOIN_WAKER;
}
fn unset_join_waker(&mut self) {
self.0 &= !JOIN_WAKER
}
pub(super) fn ref_count(self) -> usize {
(self.0 & REF_COUNT_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/state.rs | 401 | 453 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:12 | impl fmt::Debug for Snapshot {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Snapshot")
.field("is_running", &self.is_running())
.field("is_complete", &self.is_complete())
.field("is_notified", &self.is_notified())
.field("is_c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/state.rs | 441 | 453 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:1 | use crate::loom::sync::atomic::AtomicUsize;
use std::fmt;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Release};
use std::usize;
pub(super) struct State {
val: AtomicUsize,
}
/// Current state value
#[derive(Copy, Clone)]
pub(super) struct Snapshot(usize);
type UpdateResult = Result<Snapshot, Snapshot>;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:2 | const STATE_MASK: usize = LIFECYCLE_MASK | NOTIFIED | JOIN_INTEREST | JOIN_WAKER | CANCELLED;
/// Bits used by the ref count portion of the state.
const REF_COUNT_MASK: usize = !STATE_MASK;
/// Number of positions to shift the ref count
const REF_COUNT_SHIFT: usize = REF_COUNT_MASK.count_zeros() as usize;
/// One re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:3 | ///
/// If `ref_inc` is set, the reference count is also incremented.
///
/// The `NOTIFIED` bit is always unset.
pub(super) fn transition_to_running(&self, ref_inc: bool) -> UpdateResult {
self.fetch_update(|curr| {
assert!(curr.is_notified());
let mut next = curr;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:4 | let mut next = curr;
next.unset_running();
if next.is_notified() {
// The caller needs to schedule the task. To do this, it needs a
// waker. The waker requires a ref count.
next.ref_inc();
}
Some(next)
})
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:5 | if ref_dec {
// Decrement a second time
snapshot.ref_dec();
}
Some(snapshot)
})
.unwrap()
}
/// Transitions the state to `NOTIFIED`.
///
/// Returns `true` if the task needs to be submitted to the pool for
/// execution
pu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:6 | if snapshot.is_notified() {
// If the task is idle and notified, this indicates the task is
// in the run queue and is considered owned by the scheduler.
// The shutdown operation claims ownership of the task, which
// means we need to assi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7 | /// Try to unset the JOIN_INTEREST flag.
///
/// Returns `Ok` if the operation happens before the task transitions to a
/// completed state, `Err` otherwise.
pub(super) fn unset_join_interested(&self) -> UpdateResult {
self.fetch_update(|curr| {
assert!(curr.is_join_interested());
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8 | ///
/// Returns `Ok` has been unset, `Err` otherwise. This operation fails if
/// the task has completed.
pub(super) fn unset_waker(&self) -> UpdateResult {
self.fetch_update(|curr| {
assert!(curr.is_join_interested());
assert!(curr.has_join_waker());
if curr.is_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9 | }
/// Returns `true` if the task should be released.
pub(super) fn ref_dec(&self) -> bool {
let prev = Snapshot(self.val.fetch_sub(REF_ONE, AcqRel));
prev.ref_count() == 1
}
fn fetch_update<F>(&self, mut f: F) -> Result<Snapshot, Snapshot>
where
F: FnMut(Snapshot) -> Option... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10 | self.0 & NOTIFIED == NOTIFIED
}
fn unset_notified(&mut self) {
self.0 &= !NOTIFIED
}
pub(super) fn is_running(self) -> bool {
self.0 & RUNNING == RUNNING
}
fn set_running(&mut self) {
self.0 |= RUNNING;
}
fn unset_running(&mut self) {
self.0 &= !RUNNIN... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11 | fn unset_join_interested(&mut self) {
self.0 &= !JOIN_INTEREST
}
pub(super) fn has_join_waker(self) -> bool {
self.0 & JOIN_WAKER == JOIN_WAKER
}
fn set_join_waker(&mut self) {
self.0 |= JOIN_WAKER;
}
fn unset_join_waker(&mut self) {
self.0 &= !JOIN_WAKER
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 401 | 455 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:12 | }
impl fmt::Debug for Snapshot {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Snapshot")
.field("is_running", &self.is_running())
.field("is_complete", &self.is_complete())
.field("is_notified", &self.is_notified())
.field("i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/state.rs | 441 | 455 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:1 | use crate::loom::sync::atomic::AtomicUsize;
use std::fmt;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Release};
use std::usize;
pub(super) struct State {
val: AtomicUsize,
}
/// Current state value
#[derive(Copy, Clone)]
pub(super) struct Snapshot(usize);
type UpdateResult = Result<Snapshot, Snapshot>;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d101feac504fea552a6c70537f22ccb7df8635e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d101feac504fea552a6c70537f22ccb7df8635e3/tokio/src/runtime/task/state.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:2 | const CANCELLED: usize = 0b100_000;
/// All bits
const STATE_MASK: usize = LIFECYCLE_MASK | NOTIFIED | JOIN_INTEREST | JOIN_WAKER | CANCELLED;
/// Bits used by the ref count portion of the state.
const REF_COUNT_MASK: usize = !STATE_MASK;
/// Number of positions to shift the ref count
const REF_COUNT_SHIFT: usize = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d101feac504fea552a6c70537f22ccb7df8635e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d101feac504fea552a6c70537f22ccb7df8635e3/tokio/src/runtime/task/state.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:3 | }
/// Attempt to transition the lifecycle to `Running`.
///
/// If `ref_inc` is set, the reference count is also incremented.
///
/// The `NOTIFIED` bit is always unset.
pub(super) fn transition_to_running(&self, ref_inc: bool) -> UpdateResult {
self.fetch_update(|curr| {
as... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d101feac504fea552a6c70537f22ccb7df8635e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d101feac504fea552a6c70537f22ccb7df8635e3/tokio/src/runtime/task/state.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:4 | return None;
}
let mut next = curr;
next.unset_running();
if next.is_notified() {
// The caller needs to schedule the task. To do this, it needs a
// waker. The waker requires a ref count.
next.ref_inc();
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d101feac504fea552a6c70537f22ccb7df8635e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d101feac504fea552a6c70537f22ccb7df8635e3/tokio/src/runtime/task/state.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:5 | // Decrement the primary handle
snapshot.ref_dec();
if ref_dec {
// Decrement a second time
snapshot.ref_dec();
}
Some(snapshot)
})
.unwrap()
}
/// Transitions the state to `NOTIFIED`.
///
/// Returns `tru... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d101feac504fea552a6c70537f22ccb7df8635e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d101feac504fea552a6c70537f22ccb7df8635e3/tokio/src/runtime/task/state.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:6 | snapshot.ref_inc();
}
}
snapshot.set_cancelled();
Some(snapshot)
});
prev.is_idle()
}
/// Optimistically tries to swap the state assuming the join handle is
/// __immediately__ dropped on spawn
pub(super) fn drop_join_handle_fast(&se... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d101feac504fea552a6c70537f22ccb7df8635e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d101feac504fea552a6c70537f22ccb7df8635e3/tokio/src/runtime/task/state.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8 | assert!(curr.has_join_waker());
if curr.is_complete() {
return None;
}
let mut next = curr;
next.unset_join_waker();
Some(next)
})
}
pub(super) fn ref_inc(&self) {
use std::process;
use std::sync::atomic::Ord... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d101feac504fea552a6c70537f22ccb7df8635e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d101feac504fea552a6c70537f22ccb7df8635e3/tokio/src/runtime/task/state.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9 | }
fn fetch_update<F>(&self, mut f: F) -> Result<Snapshot, Snapshot>
where
F: FnMut(Snapshot) -> Option<Snapshot>,
{
let mut curr = self.load();
loop {
let next = match f(curr) {
Some(next) => next,
None => return Err(curr),
};... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d101feac504fea552a6c70537f22ccb7df8635e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d101feac504fea552a6c70537f22ccb7df8635e3/tokio/src/runtime/task/state.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10 | pub(super) fn is_running(self) -> bool {
self.0 & RUNNING == RUNNING
}
fn set_running(&mut self) {
self.0 |= RUNNING;
}
fn unset_running(&mut self) {
self.0 &= !RUNNING;
}
pub(super) fn is_cancelled(self) -> bool {
self.0 & CANCELLED == CANCELLED
}
fn ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d101feac504fea552a6c70537f22ccb7df8635e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d101feac504fea552a6c70537f22ccb7df8635e3/tokio/src/runtime/task/state.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11 | }
fn set_join_waker(&mut self) {
self.0 |= JOIN_WAKER;
}
fn unset_join_waker(&mut self) {
self.0 &= !JOIN_WAKER
}
pub(super) fn ref_count(self) -> usize {
(self.0 & REF_COUNT_MASK) >> REF_COUNT_SHIFT
}
fn ref_inc(&mut self) {
assert!(self.0 <= isize::MAX a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | d101feac504fea552a6c70537f22ccb7df8635e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d101feac504fea552a6c70537f22ccb7df8635e3/tokio/src/runtime/task/state.rs | 401 | 449 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:1 | use crate::loom::sync::atomic::AtomicUsize;
use std::fmt;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Release};
use std::usize;
pub(super) struct State {
val: AtomicUsize,
}
/// Current state value
#[derive(Copy, Clone)]
pub(super) struct Snapshot(usize);
type UpdateResult = Result<Snapshot, Snapshot>;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 9d8b37d51a7d0cdf5a0fbf754240c929fb69e9f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d8b37d51a7d0cdf5a0fbf754240c929fb69e9f2/tokio/src/runtime/task/state.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:2 | const CANCELLED: usize = 0b100_000;
/// All bits
const STATE_MASK: usize = LIFECYCLE_MASK | NOTIFIED | JOIN_INTEREST | JOIN_WAKER | CANCELLED;
/// Bits used by the ref count portion of the state.
const REF_COUNT_MASK: usize = !STATE_MASK;
/// Number of positions to shift the ref count
const REF_COUNT_SHIFT: usize = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | 9d8b37d51a7d0cdf5a0fbf754240c929fb69e9f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d8b37d51a7d0cdf5a0fbf754240c929fb69e9f2/tokio/src/runtime/task/state.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:4 | let mut next = curr;
next.unset_running();
if next.is_notified() {
// The caller needs to schedule the task. To do this, it needs a
// waker. The waker requires a ref count.
next.ref_inc();
}
Some(next)
})
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f3ed064a269fd72711e40121dad1a9fd9f16bdc0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f3ed064a269fd72711e40121dad1a9fd9f16bdc0/tokio/src/runtime/task/state.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:5 | if ref_dec {
// Decrement a second time
snapshot.ref_dec();
}
Some(snapshot)
})
.unwrap()
}
/// Transitions the state to `NOTIFIED`.
///
/// Returns `true` if the task needs to be submitted to the pool for
/// execution
pu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f3ed064a269fd72711e40121dad1a9fd9f16bdc0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f3ed064a269fd72711e40121dad1a9fd9f16bdc0/tokio/src/runtime/task/state.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:6 | snapshot.set_cancelled();
Some(snapshot)
});
prev.is_idle()
}
/// Optimistically tries to swap the state assuming the join handle is
/// __immediately__ dropped on spawn
pub(super) fn drop_join_handle_fast(&self) -> Result<(), ()> {
use std::sync::atomic::Ordering::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f3ed064a269fd72711e40121dad1a9fd9f16bdc0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f3ed064a269fd72711e40121dad1a9fd9f16bdc0/tokio/src/runtime/task/state.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7 | return None;
}
let mut next = curr;
next.unset_join_interested();
Some(next)
})
}
/// Set the `JOIN_WAKER` bit.
///
/// Returns `Ok` if the bit is set, `Err` otherwise. This operation fails if
/// the task has completed.
pub(super) fn se... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/state.rs | MIT | f3ed064a269fd72711e40121dad1a9fd9f16bdc0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f3ed064a269fd72711e40121dad1a9fd9f16bdc0/tokio/src/runtime/task/state.rs | 241 | 300 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.