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/raw.rs:1
use crate::future::Future; use crate::runtime::task::{Cell, Harness, Header, Schedule, State}; use std::ptr::NonNull; use std::task::{Poll, Waker}; /// Raw task handle pub(super) struct RawTask { ptr: NonNull<Header>, } pub(super) struct Vtable { /// Polls the future. pub(super) poll: unsafe fn(NonNull<H...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/raw.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2
pub(super) fn vtable<T: Future, S: Schedule>() -> &'static Vtable { &Vtable { poll: poll::<T, S>, dealloc: dealloc::<T, S>, try_read_output: try_read_output::<T, S>, try_set_join_waker: try_set_join_waker::<T, S>, drop_join_handle_slow: drop_join_handle_slow::<T, S>, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/runtime/task/raw.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1
use crate::future::Future; use crate::runtime::task::{Cell, Harness, Header, Schedule, State}; use std::ptr::NonNull; use std::task::{Poll, Waker}; /// Raw task handle pub(super) struct RawTask { ptr: NonNull<Header>, } pub(super) struct Vtable { /// Polls the future. pub(super) poll: unsafe fn(NonNull<H...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/raw.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2
dealloc: dealloc::<T, S>, try_read_output: try_read_output::<T, S>, try_set_join_waker: try_set_join_waker::<T, S>, drop_join_handle_slow: drop_join_handle_slow::<T, S>, remote_abort: remote_abort::<T, S>, shutdown: shutdown::<T, S>, } } impl RawTask { pub(super) fn new<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/raw.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:3
} pub(super) fn dealloc(self) { let vtable = self.header().vtable; unsafe { (vtable.dealloc)(self.ptr); } } /// Safety: `dst` must be a `*mut Poll<super::Result<T::Output>>` where `T` /// is the future stored by the task. pub(super) unsafe fn try_read_output(sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/raw.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:4
} } impl Copy for RawTask {} unsafe fn poll<T: Future, S: Schedule>(ptr: NonNull<Header>) { let harness = Harness::<T, S>::from_raw(ptr); harness.poll(); } unsafe fn dealloc<T: Future, S: Schedule>(ptr: NonNull<Header>) { let harness = Harness::<T, S>::from_raw(ptr); harness.dealloc(); } unsafe fn t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
1be8e9dfb7b1140568ac10ac34f5f8171a89e40d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/raw.rs
121
165
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2
dealloc: dealloc::<T, S>, try_read_output: try_read_output::<T, S>, try_set_join_waker: try_set_join_waker::<T, S>, drop_join_handle_slow: drop_join_handle_slow::<T, S>, remote_abort: remote_abort::<T, S>, shutdown: shutdown::<T, S>, } } impl RawTask { pub(super) fn new<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/raw.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:3
unsafe { (vtable.dealloc)(self.ptr); } } /// Safety: `dst` must be a `*mut Poll<super::Result<T::Output>>` where `T` /// is the future stored by the task. pub(super) unsafe fn try_read_output(self, dst: *mut (), waker: &Waker) { let vtable = self.header().vtable; (vt...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/raw.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:4
unsafe fn poll<T: Future, S: Schedule>(ptr: NonNull<Header>) { let harness = Harness::<T, S>::from_raw(ptr); harness.poll(); } unsafe fn dealloc<T: Future, S: Schedule>(ptr: NonNull<Header>) { let harness = Harness::<T, S>::from_raw(ptr); harness.dealloc(); } unsafe fn try_read_output<T: Future, S: Sc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/runtime/task/raw.rs
121
161
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1
use crate::future::Future; use crate::runtime::task::{Cell, Harness, Header, Schedule, State}; use std::ptr::NonNull; use std::task::{Poll, Waker}; /// Raw task handle pub(super) struct RawTask { ptr: NonNull<Header>, } pub(super) struct Vtable { /// Polls the future. pub(super) poll: unsafe fn(NonNull<H...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/raw.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2
} } impl RawTask { pub(super) fn new<T, S>(task: T, scheduler: S) -> RawTask where T: Future, S: Schedule, { let ptr = Box::into_raw(Cell::<_, S>::new(task, scheduler, State::new())); let ptr = unsafe { NonNull::new_unchecked(ptr as *mut Header) }; RawTask { ptr } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/raw.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:3
/// is the future stored by the task. pub(super) unsafe fn try_read_output(self, dst: *mut (), waker: &Waker) { let vtable = self.header().vtable; (vtable.try_read_output)(self.ptr, dst, waker); } pub(super) fn drop_join_handle_slow(self) { let vtable = self.header().vtable; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/raw.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:4
unsafe fn try_read_output<T: Future, S: Schedule>( ptr: NonNull<Header>, dst: *mut (), waker: &Waker, ) { let out = &mut *(dst as *mut Poll<super::Result<T::Output>>); let harness = Harness::<T, S>::from_raw(ptr); harness.try_read_output(out, waker); } unsafe fn drop_join_handle_slow<T: Future...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/raw.rs
121
145
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1
use crate::future::Future; use crate::runtime::task::{Cell, Harness, Header, Schedule, State}; use std::ptr::NonNull; use std::task::{Poll, Waker}; /// Raw task handle pub(super) struct RawTask { ptr: NonNull<Header>, } pub(super) struct Vtable { /// Poll the future pub(super) poll: unsafe fn(NonNull<Hea...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/raw.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1
use crate::runtime::task::{Cell, Harness, Header, Schedule, State}; use std::future::Future; use std::ptr::NonNull; use std::task::{Poll, Waker}; /// Raw task handle pub(super) struct RawTask { ptr: NonNull<Header>, } pub(super) struct Vtable { /// Poll the future pub(super) poll: unsafe fn(NonNull<Heade...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
e3851089207f6617dfcc0c7a73013eb819a0bfe0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/raw.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2
} } impl RawTask { pub(super) fn new<T, S>(task: T) -> RawTask where T: Future, S: Schedule, { let ptr = Box::into_raw(Cell::<_, S>::new(task, State::new())); let ptr = unsafe { NonNull::new_unchecked(ptr as *mut Header) }; RawTask { ptr } } pub(super) unsa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
e3851089207f6617dfcc0c7a73013eb819a0bfe0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/src/runtime/task/raw.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1
use crate::future::Future; use crate::runtime::task::{Cell, Harness, Header, Schedule, State}; use std::ptr::NonNull; use std::task::{Poll, Waker}; /// Raw task handle pub(super) struct RawTask { ptr: NonNull<Header>, } pub(super) struct Vtable { /// Poll the future pub(super) poll: unsafe fn(NonNull<Hea...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
e7d74b3119178b9b86f7b547774b6b121de2239a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/raw.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:2
pub(super) fn new<T, S>(task: T) -> RawTask where T: Future, S: Schedule, { let ptr = Box::into_raw(Cell::<_, S>::new(task, State::new())); let ptr = unsafe { NonNull::new_unchecked(ptr as *mut Header) }; RawTask { ptr } } pub(super) unsafe fn from_raw(ptr: NonN...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
e7d74b3119178b9b86f7b547774b6b121de2239a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/raw.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:3
} pub(super) fn drop_join_handle_slow(self) { let vtable = self.header().vtable; unsafe { (vtable.drop_join_handle_slow)(self.ptr) } } pub(super) fn shutdown(self) { let vtable = self.header().vtable; unsafe { (vtable.shutdown)(self.ptr) } } } impl Clone for RawTask { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
e7d74b3119178b9b86f7b547774b6b121de2239a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/raw.rs
81
131
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:4
} unsafe fn drop_join_handle_slow<T: Future, S: Schedule>(ptr: NonNull<Header>) { let harness = Harness::<T, S>::from_raw(ptr); harness.drop_join_handle_slow() } unsafe fn shutdown<T: Future, S: Schedule>(ptr: NonNull<Header>) { let harness = Harness::<T, S>::from_raw(ptr); harness.shutdown() }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
e7d74b3119178b9b86f7b547774b6b121de2239a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/raw.rs
121
131
tokio-rs/tokio:tokio/src/runtime/task/raw.rs:1
use crate::runtime::task::{Cell, Harness, Header, Schedule, State}; use std::future::Future; use std::ptr::NonNull; use std::task::{Poll, Waker}; /// Raw task handle pub(super) struct RawTask { ptr: NonNull<Header>, } pub(super) struct Vtable { /// Poll the future pub(super) poll: unsafe fn(NonNull<Heade...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/raw.rs
MIT
a78b1c65ccfb9692ca5d3ed8ddde934f40091d83
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/task/raw.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/stack.rs:1
use crate::loom::sync::atomic::AtomicPtr; use crate::runtime::task::{Header, Task}; use std::marker::PhantomData; use std::ptr::{self, NonNull}; use std::sync::atomic::Ordering::{Acquire, Relaxed, Release}; /// Concurrent stack of tasks, used to pass ownership of a task from one worker /// to another. pub(crate) stru...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/stack.rs
MIT
1cb1e291c10adf6b4e530cb1475b95ba10fa615f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1cb1e291c10adf6b4e530cb1475b95ba10fa615f/tokio/src/runtime/task/stack.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/stack.rs:2
.compare_exchange(curr, task.as_ptr() as *mut _, Release, Relaxed); match res { Ok(_) => return, Err(actual) => { curr = actual; } } } } pub(crate) fn drain(&self) -> impl Iterator<Item = Task<T>> { str...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/stack.rs
MIT
1cb1e291c10adf6b4e530cb1475b95ba10fa615f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1cb1e291c10adf6b4e530cb1475b95ba10fa615f/tokio/src/runtime/task/stack.rs
41
83
tokio-rs/tokio:tokio/src/runtime/task/stack.rs:1
use crate::loom::sync::atomic::AtomicPtr; use crate::runtime::task::{Header, Task}; use std::marker::PhantomData; use std::ptr::{self, NonNull}; use std::sync::atomic::Ordering::{Acquire, Relaxed, Release}; /// Concurrent stack of tasks, used to pass ownership of a task from one worker /// to another. pub(crate) stru...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/stack.rs
MIT
a78b1c65ccfb9692ca5d3ed8ddde934f40091d83
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/task/stack.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/stack.rs:2
match res { Ok(_) => return, Err(actual) => { curr = actual; } } } } pub(crate) fn drain(&self) -> impl Iterator<Item = Task<T>> { struct Iter<T: 'static>(Option<NonNull<Header>>, PhantomData<T>); impl<T: '...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/stack.rs
MIT
a78b1c65ccfb9692ca5d3ed8ddde934f40091d83
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/task/stack.rs
41
81
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}; pub(super) struct State { val: AtomicUsize, } /// Current state value. #[derive(Copy, Clone)] pub(super) struct Snapshot(usize); type UpdateResult = Result<Snapshot, Snapshot>; /// The task is...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
1
60
tokio-rs/tokio:tokio/src/runtime/task/state.rs:2
/// 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 ref count. const REF_ONE: usize = 1 << REF_COUNT_SHIFT; /// State a task is initialized with. /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/state.rs:3
DoNothing, Submit, Dealloc, } #[must_use] pub(crate) enum TransitionToNotifiedByRef { DoNothing, Submit, } #[must_use] pub(super) struct TransitionToJoinHandleDrop { pub(super) drop_waker: bool, pub(super) drop_output: bool, } /// All transitions are performed via RMW operations. This establi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/state.rs:4
if !next.is_idle() { // 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 { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/state.rs:5
next.unset_running(); 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 { acti...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/state.rs:6
prev.ref_count() >= count, "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...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7
// We create a new notified that we can submit. The caller // retains ownership of the ref-count they passed in. snapshot.set_notified(); snapshot.ref_inc(); action = TransitionToNotifiedByVal::Submit; } (action, Some(snapshot)) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8
/// count. /// /// Returns `true` if the notified bit was transitioned from `0` to `1`; /// otherwise `false.` #[cfg(all( tokio_unstable, feature = "taskdump", feature = "rt", target_os = "linux", any(target_arch = "aarch64", target_arch = "x86", target_arch = "x8...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9
snapshot.set_notified(); snapshot.set_cancelled(); (false, Some(snapshot)) } else { // The task is idle. We set the cancelled and notified bits and // submit a notification if the notified bit was not already // set. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10
} /// 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::Relaxed; // Relaxed is acceptable as if this function is called and succeeds, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11
if !snapshot.is_complete() { // If `COMPLETE` is unset we also unset `JOIN_WAKER` to give the // `JoinHandle` exclusive access to the waker following rule 6 in task/mod.rs. // The `JoinHandle` will drop the waker if it has exclusive access // to drop it. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/state.rs:12
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 { self...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/state.rs:13
pub(super) fn ref_inc(&self) { use std::process; use std::sync::atomic::Ordering::Relaxed; // Using a relaxed ordering is alright here, as knowledge of the // original reference prevents other threads from erroneously deleting // the object. // // As explained in...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
481
540
tokio-rs/tokio:tokio/src/runtime/task/state.rs:14
{ let mut curr = self.load(); 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); ma...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
521
580
tokio-rs/tokio:tokio/src/runtime/task/state.rs:15
// ===== impl Snapshot ===== 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 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
561
620
tokio-rs/tokio:tokio/src/runtime/task/state.rs:16
} /// Returns `true` if the task's future has completed execution. 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) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
601
660
tokio-rs/tokio:tokio/src/runtime/task/state.rs:17
} impl fmt::Debug for State { 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("...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/state.rs
641
662
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7
// We create a new notified that we can submit. The caller // retains ownership of the ref-count they passed in. snapshot.set_notified(); snapshot.ref_inc(); action = TransitionToNotifiedByVal::Submit; } (action, Some(snapshot)) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
b9feac8d6841bc7933f3d9d508f4179800d4d579
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b9feac8d6841bc7933f3d9d508f4179800d4d579/tokio/src/runtime/task/state.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8
/// count. /// /// Returns `true` if the notified bit was transitioned from `0` to `1`; /// otherwise `false.` #[cfg(all( tokio_unstable, tokio_taskdump, feature = "rt", target_os = "linux", any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
b9feac8d6841bc7933f3d9d508f4179800d4d579
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b9feac8d6841bc7933f3d9d508f4179800d4d579/tokio/src/runtime/task/state.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/state.rs:6
prev.ref_count() >= count, "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...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/tokio/src/runtime/task/state.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7
// We create a new notified that we can submit. The caller // retains ownership of the ref-count they passed in. snapshot.set_notified(); snapshot.ref_inc(); action = TransitionToNotifiedByVal::Submit; } (action, Some(snapshot)) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/tokio/src/runtime/task/state.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8
tokio_taskdump, 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() { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/tokio/src/runtime/task/state.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9
// set. 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
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/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
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/tokio/src/runtime/task/state.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11
} else { // If `COMPLETE` is set the task is completed so the `JoinHandle` is responsible // for dropping the output. transition.drop_output = true; } if !snapshot.is_join_waker_set() { // If the `JOIN_WAKER` bit is unset and the `...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/tokio/src/runtime/task/state.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/state.rs:12
/// 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 { self.fetch_update(|curr| { assert!(curr.is_join_interested()); if curr.is_complet...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/tokio/src/runtime/task/state.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/state.rs:13
// the object. // // As explained in the [Boost documentation][1], Increasing the // reference counter can always be done with memory_order_relaxed: New // references to an object can only be formed from an existing // reference, and passing an existing reference from one thread ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/tokio/src/runtime/task/state.rs
481
540
tokio-rs/tokio:tokio/src/runtime/task/state.rs:14
Some(next) => next, None => return output, }; let res = self.val.compare_exchange(curr.0, next.0, AcqRel, Acquire); match res { Ok(_) => return output, Err(actual) => curr = Snapshot(actual), } } } fn fetc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/tokio/src/runtime/task/state.rs
521
580
tokio-rs/tokio:tokio/src/runtime/task/state.rs:15
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 } fn unset_notified(&mut self) { self.0 &= !NOTIFIED; } fn set_notified(&mut self) { self.0 |= ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/tokio/src/runtime/task/state.rs
561
620
tokio-rs/tokio:tokio/src/runtime/task/state.rs:16
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) -> 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
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/tokio/src/runtime/task/state.rs
601
656
tokio-rs/tokio:tokio/src/runtime/task/state.rs:17
} } 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(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
bd3e8577377a2b684b50fc0cb50d98f03ad09703
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd3e8577377a2b684b50fc0cb50d98f03ad09703/tokio/src/runtime/task/state.rs
641
656
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11
} else { // If `COMPLETE` is set the task is completed so the `JoinHandle` is responsible // for dropping the output. transition.drop_output = true; } if !snapshot.is_join_waker_set() { // If the `JOIN_WAKER` bit is unset and the `...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
970d880ceb473b222a9ddd4b35b934ca68cecb4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/state.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/state.rs:12
/// 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 { self.fetch_update(|curr| { assert!(curr.is_join_interested()); assert!(curr.is_joi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
970d880ceb473b222a9ddd4b35b934ca68cecb4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/state.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/state.rs:13
// reference counter can always be done with memory_order_relaxed: New // references to an object can only be formed from an existing // reference, and passing an existing reference from one thread to // another must already provide any required synchronization. // // [1]: (www.b...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
970d880ceb473b222a9ddd4b35b934ca68cecb4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/state.rs
481
540
tokio-rs/tokio:tokio/src/runtime/task/state.rs:14
let res = self.val.compare_exchange(curr.0, next.0, AcqRel, Acquire); match res { Ok(_) => return output, Err(actual) => curr = Snapshot(actual), } } } fn fetch_update<F>(&self, mut f: F) -> Result<Snapshot, Snapshot> where F: FnMut(S...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
970d880ceb473b222a9ddd4b35b934ca68cecb4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/state.rs
521
580
tokio-rs/tokio:tokio/src/runtime/task/state.rs:15
/// 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; } fn set_notified(&mut self) { self.0 |= NOTIFIED; } pub(super) fn is_running(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
970d880ceb473b222a9ddd4b35b934ca68cecb4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/state.rs
561
620
tokio-rs/tokio:tokio/src/runtime/task/state.rs:16
} 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_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
970d880ceb473b222a9ddd4b35b934ca68cecb4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/state.rs
601
653
tokio-rs/tokio:tokio/src/runtime/task/state.rs:17
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
970d880ceb473b222a9ddd4b35b934ca68cecb4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/src/runtime/task/state.rs
641
653
tokio-rs/tokio:tokio/src/runtime/task/state.rs:2
/// 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 ref count. const REF_ONE: usize = 1 << REF_COUNT_SHIFT; /// State a task is initialized with. /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/state.rs:3
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 { /// Returns a task's initial state. pub(super) fn new() -> State...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/state.rs:4
if next.ref_count() == 0 { action = TransitionToRunning::Dealloc; } else { action = TransitionToRunning::Failed; } } else { // We are able to lock the RUNNING bit. next.set_running(); next...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/state.rs:5
action = TransitionToIdle::OkDealloc; } else { action = TransitionToIdle::Ok; } } else { // The caller will schedule a new notification, so we create a // new ref-count for the notification. Our own ref-count is kept ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/state.rs:6
} /// 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 incremented for the /// new Notified. pub(super) fn transition_to_notified_by_val(&self) -> TransitionToNotifiedByVal { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7
(action, Some(snapshot)) }) } /// Transitions the state to `NOTIFIED`. pub(super) fn transition_to_notified_by_ref(&self) -> TransitionToNotifiedByRef { self.fetch_update_action(|mut snapshot| { if snapshot.is_complete() || snapshot.is_notified() { // There is no...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
241
300
tokio-rs/tokio:tokio/src/runtime/task/state.rs:8
self.fetch_update_action(|mut snapshot| { if snapshot.is_notified() { (false, None) } else { snapshot.set_notified(); snapshot.ref_inc(); (true, Some(snapshot)) } }) } /// Sets the cancelled bit and tran...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9
} else { (false, Some(snapshot)) } } }) } /// 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 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10
// // Given this, there is no risk if this operation is reordered. self.val .compare_exchange_weak( INITIAL_STATE, (INITIAL_STATE - REF_ONE) & !JOIN_INTEREST, Release, Relaxed, ) .map(|_| ()) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11
if curr.is_complete() { return None; } 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 ha...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/state.rs:12
// As explained in the [Boost documentation][1], Increasing the // reference counter can always be done with memory_order_relaxed: New // references to an object can only be formed from an existing // reference, and passing an existing reference from one thread to // another must already...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/state.rs:13
}; let res = self.val.compare_exchange(curr.0, next.0, AcqRel, Acquire); match res { Ok(_) => return output, Err(actual) => curr = Snapshot(actual), } } } fn fetch_update<F>(&self, mut f: F) -> Result<Snapshot, Snapshot> where ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
481
540
tokio-rs/tokio:tokio/src/runtime/task/state.rs:14
/// 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; } fn set_notified(&mut self) { self.0 |= NOTIFIED; } pub(super) fn is_running(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
521
580
tokio-rs/tokio:tokio/src/runtime/task/state.rs:15
self.0 & JOIN_INTEREST == JOIN_INTEREST } 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...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/runtime/task/state.rs
561
614
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
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/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
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
41
100
tokio-rs/tokio:tokio/src/runtime/task/state.rs:3
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 { /// Returns a task's...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
81
140
tokio-rs/tokio:tokio/src/runtime/task/state.rs:4
next.ref_dec(); if next.ref_count() == 0 { action = TransitionToRunning::Dealloc; } else { action = TransitionToRunning::Failed; } } else { // We are able to lock the RUNNING bit. next.set...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/state.rs:5
if next.ref_count() == 0 { action = TransitionToIdle::OkDealloc; } else { action = TransitionToIdle::Ok; } } else { // The caller will schedule a new notification, so we create a // new ref-count for the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/state.rs:6
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 incremented for the /// new Notified. pub(super) fn transition_to_notified_by_val(&self) -> T...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7
} (action, Some(snapshot)) }) } /// Transitions the state to `NOTIFIED`. pub(super) fn transition_to_notified_by_ref(&self) -> TransitionToNotifiedByRef { self.fetch_update_action(|mut snapshot| { if snapshot.is_complete() || snapshot.is_notified() { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/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) -> bool { self.fetch_update_action(|mut snapshot| { if snapshot.is_notified() { (false, None) } else { snapshot.set_notified(); snapshot.ref_inc(); (true, Some(snapshot...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9
(true, Some(snapshot)) } else { (false, Some(snapshot)) } } }) } /// Sets the `CANCELLED` bit and attempts to transition to `Running`. /// /// Returns `true` if the transition to `Running` succeeded. pub(super) fn transition_to...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10
// set, at which point the CAS will fail. // // Given this, there is no risk if this operation is reordered. self.val .compare_exchange_weak( INITIAL_STATE, (INITIAL_STATE - REF_ONE) & !JOIN_INTEREST, Release, Relaxed, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/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.set_join_waker(); Some(next) }) } /// Unsets the `JOIN_WAKER` bit. /// /// Returns `Ok` has been unset, `Err` other...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
401
460
tokio-rs/tokio:tokio/src/runtime/task/state.rs:12
// // As explained in the [Boost documentation][1], Increasing the // reference counter can always be done with memory_order_relaxed: New // references to an object can only be formed from an existing // reference, and passing an existing reference from one thread to // another m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
441
500
tokio-rs/tokio:tokio/src/runtime/task/state.rs:13
None => return output, }; let res = self.val.compare_exchange(curr.0, next.0, AcqRel, Acquire); match res { Ok(_) => return output, Err(actual) => curr = Snapshot(actual), } } } fn fetch_update<F>(&self, mut f: F) -> Resu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
481
540
tokio-rs/tokio:tokio/src/runtime/task/state.rs:14
} /// 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; } fn set_notified(&mut self) { self.0 |= NOTIFIED; } pub(super) fn is_r...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
521
580
tokio-rs/tokio:tokio/src/runtime/task/state.rs:16
} 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
cb197def683277cb7ae1e00f13398b49ac225f75
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb197def683277cb7ae1e00f13398b49ac225f75/tokio/src/runtime/task/state.rs
601
615
tokio-rs/tokio:tokio/src/runtime/task/state.rs:4
next.ref_dec(); if next.ref_count() == 0 { action = TransitionToRunning::Dealloc; } else { action = TransitionToRunning::Failed; } } else { // We are able to lock the RUNNING bit. next.set...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/state.rs
121
180
tokio-rs/tokio:tokio/src/runtime/task/state.rs:5
next.ref_dec(); if next.ref_count() == 0 { action = TransitionToIdle::OkDealloc; } else { action = TransitionToIdle::Ok; } } else { // The caller will schedule a new notification, so we create a ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/state.rs
161
220
tokio-rs/tokio:tokio/src/runtime/task/state.rs:6
); 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 incremented for the /// new Notified. pub(super) fn transition_to_notified_by_val(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/state.rs
201
260
tokio-rs/tokio:tokio/src/runtime/task/state.rs:7
action = TransitionToNotifiedByVal::Submit; } (action, Some(snapshot)) }) } /// Transitions the state to `NOTIFIED`. pub(super) fn transition_to_notified_by_ref(&self) -> TransitionToNotifiedByRef { self.fetch_update_action(|mut snapshot| { if snapshot.i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/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) -> bool { self.fetch_update_action(|mut snapshot| { if snapshot.is_notified() { (false, None) } else { snapshot.set_notified(); snapshot.ref_inc(); (true, Some(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/state.rs
281
340
tokio-rs/tokio:tokio/src/runtime/task/state.rs:9
snapshot.ref_inc(); (true, Some(snapshot)) } else { (false, Some(snapshot)) } } }) } /// Sets the `CANCELLED` bit and attempts to transition to `Running`. /// /// Returns `true` if the transition to `Running` su...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/state.rs
321
380
tokio-rs/tokio:tokio/src/runtime/task/state.rs:10
// 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 if this operation is reordered. self.val .compare_exchange_weak( INITIAL_STATE, (INITIAL_STATE...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/state.rs
361
420
tokio-rs/tokio:tokio/src/runtime/task/state.rs:11
assert!(curr.is_join_interested()); assert!(!curr.is_join_waker_set()); if curr.is_complete() { return None; } let mut next = curr; next.set_join_waker(); Some(next) }) } /// Unsets the `JOIN_WAKER` bit. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/task/state.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/task/state.rs
401
460