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/task/mod.rs:8
fn bind(&self, task: &Task<Self>); /// The task has completed work and is ready to be released. The scheduler /// is free to drop it whenever. fn release(&self, task: Task<Self>); /// The has been completed by the executor it was bound to. fn release_local(&self, task: &Task<Self>); /// Sched...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/task/mod.rs
281
340
tokio-rs/tokio:tokio/src/task/mod.rs:9
self.raw.header() } pub(crate) fn into_raw(self) -> NonNull<Header> { let raw = self.raw.into_raw(); mem::forget(self); raw } } impl<S: Schedule> Task<S> { /// Returns `self` when the task needs to be immediately re-scheduled pub(crate) fn run<F>(self, mut executor: F) -> O...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/task/mod.rs
321
367
tokio-rs/tokio:tokio/src/task/mod.rs:7
cfg_rt_core! { mod spawn; pub use spawn::spawn; } mod stack; pub(crate) use self::stack::TransferStack; mod state; use self::state::{Snapshot, State}; mod waker; mod yield_now; pub use yield_now::yield_now; /// Unit tests #[cfg(test)] mod tests; use std::future::Future; use std::marker::PhantomData; use s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
d88846c4ebba8239f6c3b4465786869333451e6b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d88846c4ebba8239f6c3b4465786869333451e6b/tokio/src/task/mod.rs
241
300
tokio-rs/tokio:tokio/src/task/mod.rs:8
fn bind(&self, task: &Task<Self>); /// The task has completed work and is ready to be released. The scheduler /// is free to drop it whenever. fn release(&self, task: Task<Self>); /// The has been completed by the executor it was bound to. fn release_local(&self, task: &Task<Self>); /// Sched...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
d88846c4ebba8239f6c3b4465786869333451e6b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d88846c4ebba8239f6c3b4465786869333451e6b/tokio/src/task/mod.rs
281
340
tokio-rs/tokio:tokio/src/task/mod.rs:9
let join = JoinHandle::new(raw); (task, join) } impl<S: 'static> Task<S> { pub(crate) unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> { Task { raw: RawTask::from_raw(ptr), _p: PhantomData, } } pub(crate) fn header(&self) -> &Header { self.raw.header...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
d88846c4ebba8239f6c3b4465786869333451e6b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d88846c4ebba8239f6c3b4465786869333451e6b/tokio/src/task/mod.rs
321
380
tokio-rs/tokio:tokio/src/task/mod.rs:10
} } /// Pre-emptively cancel the task as part of the shutdown process. pub(crate) fn shutdown(self) { self.raw.cancel_from_queue(); mem::forget(self); } } impl<S: 'static> Drop for Task<S> { fn drop(&mut self) { self.raw.drop_task(); } } impl<S> fmt::Debug for Task<S> ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
d88846c4ebba8239f6c3b4465786869333451e6b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d88846c4ebba8239f6c3b4465786869333451e6b/tokio/src/task/mod.rs
361
381
tokio-rs/tokio:tokio/src/task/mod.rs:6
//! # .await; //! # } //! ``` //! //! [`task::spawn_blocking`]: crate::task::spawn_blocking //! [`task::block_in_place`]: crate::task::block_in_place //! [rt-threaded]: crate::runtime::Runtime::builder::threaded_scheduler //! [`task::yield_now`]: crate::task::yield_now() //! [`thread::yield_now`]: std::thread::yield_no...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
c223db35896bd6b6714d4793cd84290e573bb216
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c223db35896bd6b6714d4793cd84290e573bb216/tokio/src/task/mod.rs
201
260
tokio-rs/tokio:tokio/src/task/mod.rs:1
//! Asynchronous green-threads. cfg_blocking! { mod blocking; pub use blocking::spawn_blocking; cfg_rt_threaded! { pub use blocking::block_in_place; } } mod core; use self::core::Cell; pub(crate) use self::core::Header; mod error; pub use self::error::JoinError; mod harness; use self::harne...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/mod.rs
1
60
tokio-rs/tokio:tokio/src/task/mod.rs:2
mod state; use self::state::{Snapshot, State}; mod waker; mod yield_now; pub use yield_now::yield_now; /// Unit tests #[cfg(test)] mod tests; use std::future::Future; use std::marker::PhantomData; use std::ptr::NonNull; use std::{fmt, mem}; /// An owned handle to the task, tracked by ref count pub(crate) struct Ta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/mod.rs
41
100
tokio-rs/tokio:tokio/src/task/mod.rs:3
fn release_local(&self, task: &Task<Self>); /// Schedule the task fn schedule(&self, task: Task<Self>); } cfg_rt_threaded! { /// Create a new task without an associated join handle pub(crate) fn background<T, S>(task: T) -> Task<S> where T: Future + Send + 'static, S: Schedule, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/mod.rs
81
140
tokio-rs/tokio:tokio/src/task/mod.rs:4
Task { raw: RawTask::from_raw(ptr), _p: PhantomData, } } pub(crate) fn header(&self) -> &Header { self.raw.header() } pub(crate) fn into_raw(self) -> NonNull<Header> { let raw = self.raw.into_raw(); mem::forget(self); raw } } impl<S:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/mod.rs
121
174
tokio-rs/tokio:tokio/src/task/mod.rs:5
} } impl<S: 'static> Drop for Task<S> { fn drop(&mut self) { self.raw.drop_task(); } } impl<S> fmt::Debug for Task<S> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Task").finish() } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/mod.rs
161
174
tokio-rs/tokio:tokio/src/task/mod.rs:1
//! Asynchronous green-threads. #[cfg(feature = "blocking")] mod blocking; #[cfg(feature = "rt-full")] pub use blocking::block_in_place; #[cfg(feature = "blocking")] pub use blocking::spawn_blocking; mod core; use self::core::Cell; pub(crate) use self::core::Header; mod error; pub use self::error::JoinError; mod ha...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/task/mod.rs
1
60
tokio-rs/tokio:tokio/src/task/mod.rs:2
mod waker; mod yield_now; pub use yield_now::yield_now; /// Unit tests #[cfg(test)] mod tests; use std::future::Future; use std::marker::PhantomData; use std::ptr::NonNull; use std::{fmt, mem}; /// An owned handle to the task, tracked by ref count pub(crate) struct Task<S: 'static> { raw: RawTask, _p: Phant...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/task/mod.rs
41
100
tokio-rs/tokio:tokio/src/task/mod.rs:3
fn schedule(&self, task: Task<Self>); } /// Create a new task without an associated join handle #[cfg(feature = "rt-full")] pub(crate) fn background<T, S>(task: T) -> Task<S> where T: Future + Send + 'static, S: Schedule, { Task { raw: RawTask::new_background::<_, S>(task), _p: PhantomData,...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/task/mod.rs
81
140
tokio-rs/tokio:tokio/src/task/mod.rs:4
} pub(crate) fn header(&self) -> &Header { self.raw.header() } pub(crate) fn into_raw(self) -> NonNull<Header> { let raw = self.raw.into_raw(); mem::forget(self); raw } } impl<S: Schedule> Task<S> { /// Returns `self` when the task needs to be immediately re-schedu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/task/mod.rs
121
170
tokio-rs/tokio:tokio/src/task/mod.rs:5
fn drop(&mut self) { self.raw.drop_task(); } } impl<S> fmt::Debug for Task<S> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Task").finish() } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/task/mod.rs
161
170
tokio-rs/tokio:tokio/src/task/mod.rs:1
//! Asynchronous green-threads. mod core; use self::core::Cell; pub(crate) use self::core::Header; mod error; pub use self::error::JoinError; mod harness; use self::harness::Harness; mod join; #[cfg(feature = "rt-core")] #[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411 pub use self::join:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/task/mod.rs
1
60
tokio-rs/tokio:tokio/src/task/mod.rs:2
#[cfg(test)] mod tests; use std::future::Future; use std::marker::PhantomData; use std::ptr::NonNull; use std::{fmt, mem}; /// An owned handle to the task, tracked by ref count pub(crate) struct Task<S: 'static> { raw: RawTask, _p: PhantomData<S>, } unsafe impl<S: Send + Sync + 'static> Send for Task<S> {} ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/task/mod.rs
41
100
tokio-rs/tokio:tokio/src/task/mod.rs:3
T: Future + Send + 'static, S: Schedule, { Task { raw: RawTask::new_background::<_, S>(task), _p: PhantomData, } } /// Create a new task with an associated join handle pub(crate) fn joinable<T, S>(task: T) -> (Task<S>, JoinHandle<T::Output>) where T: Future + Send + 'static, S: Sche...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/task/mod.rs
81
140
tokio-rs/tokio:tokio/src/task/mod.rs:4
let raw = self.raw.into_raw(); mem::forget(self); raw } } impl<S: Schedule> Task<S> { /// Returns `self` when the task needs to be immediately re-scheduled pub(crate) fn run<F>(self, mut executor: F) -> Option<Self> where F: FnMut() -> Option<NonNull<S>>, { if unsafe...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/mod.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/task/mod.rs
121
163
tokio-rs/tokio:tokio/src/task/queue.rs:1
use super::{OwnedList, Schedule, Task, TransferStack}; use std::{ cell::UnsafeCell, collections::VecDeque, fmt, sync::{Mutex, MutexGuard}, }; /// A set of multi-producer, single consumer task queues, suitable for use by a /// single-threaded scheduler. /// /// This consists of a list of _all_ tasks bou...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/queue.rs
1
60
tokio-rs/tokio:tokio/src/task/queue.rs:2
/// Tasks notified from another thread are pushed into this queue. remote_queue: Mutex<RemoteQueue<S>>, /// Tasks pending drop pending_drop: TransferStack<S>, } pub(crate) struct RemoteQueue<S: 'static> { /// FIFO list of tasks queue: VecDeque<Task<S>>, /// `true` when a task can be pushed in...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/queue.rs
41
100
tokio-rs/tokio:tokio/src/task/queue.rs:3
/// # Safety /// /// This *must* be called only from the thread that owns the scheduler. pub(crate) unsafe fn add_task(&self, task: &Task<S>) { (*self.owned_tasks.get()).insert(task); } /// Pushes a task to the local queue. /// /// # Safety /// /// This *must* be called only...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/queue.rs
81
140
tokio-rs/tokio:tokio/src/task/queue.rs:4
/// /// This simply pushes the task to the pending drop queue. pub(crate) fn release_remote(&self, task: Task<S>) { self.pending_drop.push(task); } /// Returns the next task from the remote *or* local queue. /// /// Typically, this checks the local queue before the remote queue, and onl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/queue.rs
121
180
tokio-rs/tokio:tokio/src/task/queue.rs:5
// there is no semantic information in the `PoisonError`, and it // doesn't implement `Debug`, but clippy thinks that it's bad to // match all errors here... #[allow(clippy::match_wild_err_arm)] let mut lock = match self.remote_queue.lock() { // If the lock is poisoned, but t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/queue.rs
161
220
tokio-rs/tokio:tokio/src/task/queue.rs:6
/// 1. Close the remote queue (so that it will no longer accept new tasks). /// 2. Drain the remote queue and shut down all tasks. /// 3. Drain the local queue and shut down all tasks. /// 4. Shut down the owned task list. /// 5. Drain the list of tasks dropped externally and remove them from the //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/queue.rs
201
260
tokio-rs/tokio:tokio/src/task/queue.rs:7
pub(crate) unsafe fn drain_queues(&self) { self.close_local(); self.close_remote(); } /// Shuts down the scheduler's owned task list. /// /// # Safety /// /// This *must* be called only from the thread that owns the scheduler. unsafe fn shutdown_owned_tasks(&self) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/queue.rs
241
300
tokio-rs/tokio:tokio/src/task/queue.rs:8
} else { return; } } } /// Drains the local queue, and shut down its tasks. /// /// # Safety /// /// This *must* be called only from the thread that owns the scheduler. unsafe fn close_local(&self) { while let Some(task) = self.next_local_task() {...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/queue.rs
281
338
tokio-rs/tokio:tokio/src/task/queue.rs:9
/// `spawn` should be set if the caller is spawning a new task. pub(crate) fn schedule(&mut self, task: Task<S>, spawn: bool) { if !spawn || self.open { self.queue.push_back(task); } else { task.shutdown(); } } } impl<S> fmt::Debug for RemoteQueue<S> { fn fmt...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/queue.rs
321
338
tokio-rs/tokio:tokio/src/task/queue.rs:1
use super::{OwnedList, Schedule, Task, TransferStack}; use std::{ cell::UnsafeCell, collections::VecDeque, fmt, sync::{Mutex, MutexGuard}, }; /// A set of multi-producer, single consumer task queues, suitable for use by a /// single-threaded scheduler. /// /// This consists of a list of _all_ tasks bou...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
855d39f849cc16d3c68df5abf0bbb28e3351cdf0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/855d39f849cc16d3c68df5abf0bbb28e3351cdf0/tokio/src/task/queue.rs
1
60
tokio-rs/tokio:tokio/src/task/queue.rs:2
/// Tasks notified from another thread are pushed into this queue. remote_queue: Mutex<RemoteQueue<S>>, /// Tasks pending drop pending_drop: TransferStack<S>, } pub(crate) struct RemoteQueue<S: 'static> { /// FIFO list of tasks queue: VecDeque<Task<S>>, /// `true` when a task can be pushed in...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
855d39f849cc16d3c68df5abf0bbb28e3351cdf0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/855d39f849cc16d3c68df5abf0bbb28e3351cdf0/tokio/src/task/queue.rs
41
100
tokio-rs/tokio:tokio/src/task/queue.rs:3
/// # Safety /// /// This *must* be called only from the thread that owns the scheduler. pub(crate) unsafe fn add_task(&self, task: &Task<S>) { (*self.owned_tasks.get()).insert(task); } /// Push a task to the local queue. /// /// # Safety /// /// This *must* be called only f...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
855d39f849cc16d3c68df5abf0bbb28e3351cdf0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/855d39f849cc16d3c68df5abf0bbb28e3351cdf0/tokio/src/task/queue.rs
81
140
tokio-rs/tokio:tokio/src/task/queue.rs:4
/// /// This simply pushes the task to the pending drop queue. pub(crate) fn release_remote(&self, task: Task<S>) { self.pending_drop.push(task); } /// Returns the next task from the remote *or* local queue. /// /// Typically, this checks the local queue before the remote queue, and onl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
855d39f849cc16d3c68df5abf0bbb28e3351cdf0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/855d39f849cc16d3c68df5abf0bbb28e3351cdf0/tokio/src/task/queue.rs
121
180
tokio-rs/tokio:tokio/src/task/queue.rs:5
// there is no semantic information in the `PoisonError`, and it // doesn't implement `Debug`, but clippy thinks that it's bad to // match all errors here... #[allow(clippy::match_wild_err_arm)] let mut lock = match self.remote_queue.lock() { // If the lock is poisoned, but t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
855d39f849cc16d3c68df5abf0bbb28e3351cdf0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/855d39f849cc16d3c68df5abf0bbb28e3351cdf0/tokio/src/task/queue.rs
161
220
tokio-rs/tokio:tokio/src/task/queue.rs:6
/// 1. Close the remote queue (so that it will no longer accept new tasks). /// 2. Drain the remote queue and shut down all tasks. /// 3. Drain the local queue and shut down all tasks. /// 4. Shut down the owned task list. /// 5. Drain the list of tasks dropped externally and remove them from the //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
855d39f849cc16d3c68df5abf0bbb28e3351cdf0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/855d39f849cc16d3c68df5abf0bbb28e3351cdf0/tokio/src/task/queue.rs
201
260
tokio-rs/tokio:tokio/src/task/queue.rs:7
pub(crate) unsafe fn drain_queues(&self) { self.close_local(); self.close_remote(); } /// Shut down the scheduler's owned task list. /// /// # Safety /// /// This *must* be called only from the thread that owns the scheduler. unsafe fn shutdown_owned_tasks(&self) { (...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
855d39f849cc16d3c68df5abf0bbb28e3351cdf0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/855d39f849cc16d3c68df5abf0bbb28e3351cdf0/tokio/src/task/queue.rs
241
300
tokio-rs/tokio:tokio/src/task/queue.rs:8
} else { return; } } } /// Drain the local queue, and shut down its tasks. /// /// # Safety /// /// This *must* be called only from the thread that owns the scheduler. unsafe fn close_local(&self) { while let Some(task) = self.next_local_task() { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
855d39f849cc16d3c68df5abf0bbb28e3351cdf0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/855d39f849cc16d3c68df5abf0bbb28e3351cdf0/tokio/src/task/queue.rs
281
338
tokio-rs/tokio:tokio/src/task/queue.rs:7
pub(crate) unsafe fn drain_queues(&self) { self.close_local(); self.close_remote(); } /// Shut down the scheduler's owned task list. /// /// # Safety /// /// This *must* be called only from the thread that owns the scheduler. unsafe fn shutdown_owned_tasks(&self) { (...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
41d15ea212525f4be310d65c29c626488af546e1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/41d15ea212525f4be310d65c29c626488af546e1/tokio/src/task/queue.rs
241
300
tokio-rs/tokio:tokio/src/task/queue.rs:8
/// /// # Safety /// /// This *must* be called only from the thread that owns the scheduler. unsafe fn close_local(&self) { while let Some(task) = self.next_local_task() { task.shutdown(); } } } impl<S> fmt::Debug for MpscQueues<S> { fn fmt(&self, fmt: &mut fmt::Form...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
41d15ea212525f4be310d65c29c626488af546e1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/41d15ea212525f4be310d65c29c626488af546e1/tokio/src/task/queue.rs
281
331
tokio-rs/tokio:tokio/src/task/queue.rs:9
} } impl<S> fmt::Debug for RemoteQueue<S> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("RemoteQueue") .field("queue", &self.queue) .field("open", &self.open) .finish() } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
41d15ea212525f4be310d65c29c626488af546e1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/41d15ea212525f4be310d65c29c626488af546e1/tokio/src/task/queue.rs
321
331
tokio-rs/tokio:tokio/src/task/queue.rs:6
/// 1. Close the remote queue (so that it will no longer accept new tasks). /// 2. Drain the remote queue and shut down all tasks. /// 3. Drain the local queue and shut down all tasks. /// 4. Shut down the owned task list. /// 5. Drain the list of tasks dropped externally and remove them from the //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
0e729aa341028c121b9c39fe552ed4309bae6b6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0e729aa341028c121b9c39fe552ed4309bae6b6a/tokio/src/task/queue.rs
201
260
tokio-rs/tokio:tokio/src/task/queue.rs:7
unsafe fn shutdown_owned_tasks(&self) { (*self.owned_tasks.get()).shutdown(); } /// Drain the remote queue, and shut down its tasks. /// /// This closes the remote queue. Any additional tasks added to it will be /// shut down instead. /// /// # Panics /// If the mutex around the...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
0e729aa341028c121b9c39fe552ed4309bae6b6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0e729aa341028c121b9c39fe552ed4309bae6b6a/tokio/src/task/queue.rs
241
300
tokio-rs/tokio:tokio/src/task/queue.rs:8
impl<S> fmt::Debug for MpscQueues<S> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("MpscQueues") .field("owned_tasks", &self.owned_tasks) .field("remote_queue", &self.remote_queue) .field("local_queue", &self.local_queue) .fin...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/queue.rs
MIT
0e729aa341028c121b9c39fe552ed4309bae6b6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0e729aa341028c121b9c39fe552ed4309bae6b6a/tokio/src/task/queue.rs
281
319
tokio-rs/tokio:tokio/src/task/raw.rs:1
use crate::loom::alloc::Track; use crate::task::Cell; use crate::task::Harness; use crate::task::{Header, Schedule, ScheduleSendOnly}; use crate::task::{Snapshot, State}; use std::future::Future; use std::ptr::NonNull; use std::task::Waker; /// Raw task handle pub(super) struct RawTask { ptr: NonNull<Header>, } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
38e602f4d812c196d5dc0bc245e79ccad4e77cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/38e602f4d812c196d5dc0bc245e79ccad4e77cfd/tokio/src/task/raw.rs
1
60
tokio-rs/tokio:tokio/src/task/raw.rs:2
pub(super) cancel: unsafe fn(*mut (), bool), } /// Get the vtable for the requested `T` and `S` generics. pub(super) fn vtable<T: Future, S: Schedule>() -> &'static Vtable { &Vtable { poll: poll::<T, S>, drop_task: drop_task::<T, S>, read_output: read_output::<T, S>, store_join_wake...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
38e602f4d812c196d5dc0bc245e79ccad4e77cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/38e602f4d812c196d5dc0bc245e79ccad4e77cfd/tokio/src/task/raw.rs
41
100
tokio-rs/tokio:tokio/src/task/raw.rs:3
S: Schedule, { let ptr = Box::into_raw(Cell::new::<S>(task, state)); let ptr = unsafe { NonNull::new_unchecked(ptr as *mut Header) }; RawTask { ptr } } pub(super) unsafe fn from_raw(ptr: NonNull<Header>) -> RawTask { RawTask { ptr } } /// Returns a reference to the...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
38e602f4d812c196d5dc0bc245e79ccad4e77cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/38e602f4d812c196d5dc0bc245e79ccad4e77cfd/tokio/src/task/raw.rs
81
140
tokio-rs/tokio:tokio/src/task/raw.rs:4
} pub(super) unsafe fn read_output(self, dst: *mut (), state: Snapshot) { let vtable = self.header().vtable; (vtable.read_output)(self.ptr.as_ptr() as *mut (), dst, state); } pub(super) fn store_join_waker(self, waker: &Waker) -> Snapshot { let vtable = self.header().vtable; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
38e602f4d812c196d5dc0bc245e79ccad4e77cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/38e602f4d812c196d5dc0bc245e79ccad4e77cfd/tokio/src/task/raw.rs
121
180
tokio-rs/tokio:tokio/src/task/raw.rs:5
let harness = Harness::<T, S>::from_raw(ptr); harness.poll(executor) } unsafe fn drop_task<T: Future, S: Schedule>(ptr: *mut ()) { let harness = Harness::<T, S>::from_raw(ptr); harness.drop_task(); } unsafe fn read_output<T: Future, S: Schedule>(ptr: *mut (), dst: *mut (), state: Snapshot) { let harne...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
38e602f4d812c196d5dc0bc245e79ccad4e77cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/38e602f4d812c196d5dc0bc245e79ccad4e77cfd/tokio/src/task/raw.rs
161
197
tokio-rs/tokio:tokio/src/task/raw.rs:1
use crate::loom::alloc::Track; use crate::task::Cell; use crate::task::Harness; use crate::task::{Header, Schedule}; use crate::task::{Snapshot, State}; use std::future::Future; use std::ptr::NonNull; use std::task::Waker; /// Raw task handle pub(super) struct RawTask { ptr: NonNull<Header>, } pub(super) struct ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/task/raw.rs
1
60
tokio-rs/tokio:tokio/src/task/raw.rs:2
pub(super) cancel: unsafe fn(*mut (), bool), } /// Get the vtable for the requested `T` and `S` generics. pub(super) fn vtable<T: Future, S: Schedule>() -> &'static Vtable { &Vtable { poll: poll::<T, S>, drop_task: drop_task::<T, S>, read_output: read_output::<T, S>, store_join_wake...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/task/raw.rs
41
100
tokio-rs/tokio:tokio/src/task/raw.rs:3
/// Returns a reference to the task's meta structure. /// /// Safe as `Header` is `Sync`. pub(super) fn header(&self) -> &Header { unsafe { self.ptr.as_ref() } } /// Returns a raw pointer to the task's meta structure. pub(super) fn into_raw(self) -> NonNull<Header> { self.ptr ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/task/raw.rs
81
140
tokio-rs/tokio:tokio/src/task/raw.rs:4
pub(super) fn swap_join_waker(self, waker: &Waker, prev: Snapshot) -> Snapshot { let vtable = self.header().vtable; unsafe { (vtable.swap_join_waker)(self.ptr.as_ptr() as *mut (), waker, prev) } } pub(super) fn drop_join_handle_slow(self) { let vtable = self.header().vtable; uns...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/task/raw.rs
121
180
tokio-rs/tokio:tokio/src/task/raw.rs:5
} unsafe fn store_join_waker<T: Future, S: Schedule>(ptr: *mut (), waker: &Waker) -> Snapshot { let harness = Harness::<T, S>::from_raw(ptr); harness.store_join_waker(waker) } unsafe fn swap_join_waker<T: Future, S: Schedule>( ptr: *mut (), waker: &Waker, prev: Snapshot, ) -> Snapshot { let ha...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/task/raw.rs
161
185
tokio-rs/tokio:tokio/src/task/raw.rs:1
use crate::loom::alloc::Track; use crate::task::Cell; use crate::task::Harness; use crate::task::{Header, Schedule}; use crate::task::{Snapshot, State}; use std::future::Future; use std::ptr::NonNull; use std::task::Waker; /// Raw task handle pub(super) struct RawTask { ptr: NonNull<Header>, } pub(super) struct ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/raw.rs
1
60
tokio-rs/tokio:tokio/src/task/raw.rs:2
pub(super) cancel: unsafe fn(*mut (), bool), } /// Get the vtable for the requested `T` and `S` generics. pub(super) fn vtable<T: Future, S: Schedule>() -> &'static Vtable { &Vtable { poll: poll::<T, S>, drop_task: drop_task::<T, S>, read_output: read_output::<T, S>, store_join_wake...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/raw.rs
41
100
tokio-rs/tokio:tokio/src/task/raw.rs:1
use crate::loom::alloc::Track; use crate::task::Cell; use crate::task::Harness; use crate::task::{Header, Schedule}; use crate::task::{Snapshot, State}; use std::future::Future; use std::ptr::NonNull; use std::task::Waker; /// Raw task handle pub(super) struct RawTask { ptr: NonNull<Header>, } pub(super) struct ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/task/raw.rs
1
60
tokio-rs/tokio:tokio/src/task/raw.rs:2
pub(super) cancel: unsafe fn(*mut (), bool), } /// Get the vtable for the requested `T` and `S` generics. pub(super) fn vtable<T: Future, S: Schedule>() -> &'static Vtable { &Vtable { poll: poll::<T, S>, drop_task: drop_task::<T, S>, read_output: read_output::<T, S>, store_join_wake...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/task/raw.rs
41
100
tokio-rs/tokio:tokio/src/task/raw.rs:3
let ptr = unsafe { NonNull::new_unchecked(ptr as *mut Header) }; RawTask { ptr } } pub(super) unsafe fn from_raw(ptr: NonNull<Header>) -> RawTask { RawTask { ptr } } /// Returns a reference to the task's meta structure. /// /// Safe as `Header` is `Sync`. pub(super) fn hea...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/task/raw.rs
81
140
tokio-rs/tokio:tokio/src/task/raw.rs:4
let vtable = self.header().vtable; (vtable.read_output)(self.ptr.as_ptr() as *mut (), dst, state); } pub(super) fn store_join_waker(self, waker: &Waker) -> Snapshot { let vtable = self.header().vtable; unsafe { (vtable.store_join_waker)(self.ptr.as_ptr() as *mut (), waker) } } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/task/raw.rs
121
180
tokio-rs/tokio:tokio/src/task/raw.rs:5
unsafe fn drop_task<T: Future, S: Schedule>(ptr: *mut ()) { let harness = Harness::<T, S>::from_raw(ptr); harness.drop_task(); } unsafe fn read_output<T: Future, S: Schedule>(ptr: *mut (), dst: *mut (), state: Snapshot) { let harness = Harness::<T, S>::from_raw(ptr); harness.read_output(dst as *mut Tra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/raw.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/task/raw.rs
161
194
tokio-rs/tokio:tokio/src/task/stack.rs:1
use crate::loom::sync::atomic::AtomicPtr; use crate::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) struct Transf...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/stack.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/task/stack.rs
1
60
tokio-rs/tokio:tokio/src/task/stack.rs:2
self.head .compare_exchange(curr, task.as_ptr() as *mut _, Release, Relaxed); match res { Ok(_) => return, Err(actual) => { curr = actual; } } } } } p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/stack.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/task/stack.rs
41
88
tokio-rs/tokio:tokio/src/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); /// The task is currently being run. const RUNNIN...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
1
60
tokio-rs/tokio:tokio/src/task/state.rs:2
/// Bits used by the waker ref count portion of the state. /// /// Ref counts only cover **wakers**. Other handles are tracked with other state /// bits. const WAKER_COUNT_MASK: usize = usize::MAX - LIFECYCLE_MASK; /// Number of positions to shift the ref count const WAKER_COUNT_SHIFT: usize = WAKER_COUNT_MASK.count_z...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
41
100
tokio-rs/tokio:tokio/src/task/state.rs:3
if prev.is_running() { // We were signalled to cancel // // Apply the state let prev = self.val.fetch_or(CANCELLED, AcqRel); return Snapshot(prev | CANCELLED); } assert!(!prev.is_running()); let next = Snapshot(prev.0 ^ DELTA); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
81
140
tokio-rs/tokio:tokio/src/task/state.rs:4
/// Transitions the task from `Running` -> `Complete`. /// /// Returns a snapshot of the state **after** the transition. pub(super) fn transition_to_complete(&self) -> Snapshot { const DELTA: usize = RUNNING | COMPLETE; let prev = Snapshot(self.val.fetch_xor(DELTA, AcqRel)); assert...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
121
180
tokio-rs/tokio:tokio/src/task/state.rs:5
/// /// Returns the snapshot of the state **after** the transition **if** the /// transition was made successfully /// /// # States /// /// - Notifed: task may be in a queue, caller must not release. /// - Running: cannot drop. The poll handle will handle releasing. /// - Other prior sta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
161
220
tokio-rs/tokio:tokio/src/task/state.rs:6
} let res = self.val.compare_exchange(prev.0, next.0, AcqRel, Acquire); match res { Ok(_) if next.is_canceled() => return Some(next), Ok(_) => return None, Err(actual) => { prev = Snapshot(actual); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
201
260
tokio-rs/tokio:tokio/src/task/state.rs:7
/// Transitions the state to `Scheduled`. /// /// Returns `true` if the task needs to be submitted to the pool for /// execution pub(super) fn transition_to_notified(&self) -> bool { const MASK: usize = RUNNING | NOTIFIED | COMPLETE | CANCELLED; let prev = self.val.fetch_or(NOTIFIED, Re...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
241
300
tokio-rs/tokio:tokio/src/task/state.rs:8
const DELTA: usize = JOIN_INTEREST; let prev = Snapshot(self.val.fetch_sub(DELTA, Release)); assert!(prev.is_join_interested()); let next = Snapshot(prev.0 - DELTA); if !next.is_final_ref() { return next; } atomic::fence(Acquire); next } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
281
340
tokio-rs/tokio:tokio/src/task/state.rs:9
Ok(_) => { return Ok(Snapshot(next)); } Err(actual) => { prev = actual; } } } } /// Stores the join waker. pub(super) fn store_join_waker(&self) -> Snapshot { use crate::loom::sync::atomic; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
321
380
tokio-rs/tokio:tokio/src/task/state.rs:10
} assert!(Snapshot(prev).has_join_waker()); let next = prev - JOIN_WAKER; let res = self.val.compare_exchange(prev, next, AcqRel, Acquire); match res { Ok(_) => return Snapshot(next), Err(actual) => { prev = actual; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
361
420
tokio-rs/tokio:tokio/src/task/state.rs:11
/// Returns `true` if the task should be released. pub(super) fn ref_dec(&self) -> bool { use crate::loom::sync::atomic; let prev = self.val.fetch_sub(WAKER_ONE, Release); let next = Snapshot(prev - WAKER_ONE); if next.is_final_ref() { atomic::fence(Acquire); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
401
460
tokio-rs/tokio:tokio/src/task/state.rs:12
/// Used before dropping the task pub(super) fn is_terminal(self) -> bool { // When both the notified & running flags are set, the task was canceled // after being notified, before it was run. // // There is a race where: // - The task state transitions to notified //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
441
497
tokio-rs/tokio:tokio/src/task/state.rs:13
} } 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_notified", &self.is_notified()) .field("is_released", &self.is_released()) .field(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b70f1ce3c00ea5f6215f6970dfcf6e9adc9a8464/tokio/src/task/state.rs
481
497
tokio-rs/tokio:tokio/src/task/state.rs:2
/// Bits used by the waker ref count portion of the state. /// /// Ref counts only cover **wakers**. Other handles are tracked with other state /// bits. const WAKER_COUNT_MASK: usize = usize::MAX - LIFECYCLE_MASK; /// Number of positions to shift the ref count const WAKER_COUNT_SHIFT: usize = WAKER_COUNT_MASK.count_z...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/state.rs
41
100
tokio-rs/tokio:tokio/src/task/state.rs:3
if prev.is_running() { // We were signalled to cancel // // Apply the state let prev = self.val.fetch_or(CANCELLED, AcqRel); return Snapshot(prev | CANCELLED); } debug_assert!(!prev.is_running()); let next = Snapshot(prev.0 ^ DELTA); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/state.rs
81
140
tokio-rs/tokio:tokio/src/task/state.rs:4
/// Transitions the task from `Running` -> `Complete`. /// /// Returns a snapshot of the state **after** the transition. pub(super) fn transition_to_complete(&self) -> Snapshot { const DELTA: usize = RUNNING | COMPLETE; let prev = Snapshot(self.val.fetch_xor(DELTA, AcqRel)); debug_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/state.rs
121
180
tokio-rs/tokio:tokio/src/task/state.rs:5
/// /// Returns the snapshot of the state **after** the transition **if** the /// transition was made successfully /// /// # States /// /// - Notifed: task may be in a queue, caller must not release. /// - Running: cannot drop. The poll handle will handle releasing. /// - Other prior sta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/state.rs
161
220
tokio-rs/tokio:tokio/src/task/state.rs:6
} let res = self.val.compare_exchange(prev.0, next.0, AcqRel, Acquire); match res { Ok(_) if next.is_canceled() => return Some(next), Ok(_) => return None, Err(actual) => { prev = Snapshot(actual); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/state.rs
201
260
tokio-rs/tokio:tokio/src/task/state.rs:7
/// Transitions the state to `Scheduled`. /// /// Returns `true` if the task needs to be submitted to the pool for /// execution pub(super) fn transition_to_notified(&self) -> bool { const MASK: usize = RUNNING | NOTIFIED | COMPLETE | CANCELLED; let prev = self.val.fetch_or(NOTIFIED, Re...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/state.rs
241
300
tokio-rs/tokio:tokio/src/task/state.rs:8
const DELTA: usize = JOIN_INTEREST; let prev = Snapshot(self.val.fetch_sub(DELTA, Release)); debug_assert!(prev.is_join_interested()); let next = Snapshot(prev.0 - DELTA); if !next.is_final_ref() { return next; } atomic::fence(Acquire); next ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/state.rs
281
340
tokio-rs/tokio:tokio/src/task/state.rs:9
Ok(_) => { return Ok(Snapshot(next)); } Err(actual) => { prev = actual; } } } } /// Stores the join waker. pub(super) fn store_join_waker(&self) -> Snapshot { use crate::loom::sync::atomic; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/state.rs
321
380
tokio-rs/tokio:tokio/src/task/state.rs:10
} debug_assert!(Snapshot(prev).has_join_waker()); let next = prev - JOIN_WAKER; let res = self.val.compare_exchange(prev, next, AcqRel, Acquire); match res { Ok(_) => return Snapshot(next), Err(actual) => { prev = ac...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/task/state.rs
361
420
tokio-rs/tokio:tokio/src/task/state.rs:2
/// Bits used by the waker ref count portion of the state. /// /// Ref counts only cover **wakers**. Other handles are tracked with other state /// bits. const WAKER_COUNT_MASK: usize = usize::MAX - LIFECYCLE_MASK; /// Number of positions to shift the ref count const WAKER_COUNT_SHIFT: usize = WAKER_COUNT_MASK.count_z...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
a7a79f28a8fe288ec92593835583160f455707ad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7a79f28a8fe288ec92593835583160f455707ad/tokio/src/task/state.rs
41
100
tokio-rs/tokio:tokio/src/task/state.rs:3
if prev.is_running() { // We were signalled to cancel // // Apply the state let prev = self.val.fetch_or(CANCELLED, AcqRel); return Snapshot(prev | CANCELLED); } debug_assert!(!prev.is_running()); let next = Snapshot(prev.0 ^ DELTA); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
a7a79f28a8fe288ec92593835583160f455707ad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7a79f28a8fe288ec92593835583160f455707ad/tokio/src/task/state.rs
81
140
tokio-rs/tokio:tokio/src/task/state.rs:4
/// Transition the task from `Running` -> `Complete`. /// /// Returns a snapshot of the state **after** the transition. pub(super) fn transition_to_complete(&self) -> Snapshot { const DELTA: usize = RUNNING | COMPLETE; let prev = Snapshot(self.val.fetch_xor(DELTA, AcqRel)); debug_a...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
a7a79f28a8fe288ec92593835583160f455707ad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7a79f28a8fe288ec92593835583160f455707ad/tokio/src/task/state.rs
121
180
tokio-rs/tokio:tokio/src/task/state.rs:5
/// /// Returns the snapshot of the state **after** the transition **if** the /// transition was made successfully /// /// # States /// /// - Notifed: task may be in a queue, caller must not release. /// - Running: cannot drop. The poll handle will handle releasing. /// - Other prior sta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
a7a79f28a8fe288ec92593835583160f455707ad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7a79f28a8fe288ec92593835583160f455707ad/tokio/src/task/state.rs
161
220
tokio-rs/tokio:tokio/src/task/state.rs:6
} let res = self.val.compare_exchange(prev.0, next.0, AcqRel, Acquire); match res { Ok(_) if next.is_canceled() => return Some(next), Ok(_) => return None, Err(actual) => { prev = Snapshot(actual); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
a7a79f28a8fe288ec92593835583160f455707ad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7a79f28a8fe288ec92593835583160f455707ad/tokio/src/task/state.rs
201
260
tokio-rs/tokio:tokio/src/task/state.rs:7
/// Transition the state to `Scheduled`. /// /// Returns `true` if the task needs to be submitted to the pool for /// execution pub(super) fn transition_to_notified(&self) -> bool { const MASK: usize = RUNNING | NOTIFIED | COMPLETE | CANCELLED; let prev = self.val.fetch_or(NOTIFIED, Rel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
a7a79f28a8fe288ec92593835583160f455707ad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7a79f28a8fe288ec92593835583160f455707ad/tokio/src/task/state.rs
241
300
tokio-rs/tokio:tokio/src/task/state.rs:8
const DELTA: usize = JOIN_INTEREST; let prev = Snapshot(self.val.fetch_sub(DELTA, Release)); debug_assert!(prev.is_join_interested()); let next = Snapshot(prev.0 - DELTA); if !next.is_final_ref() { return next; } atomic::fence(Acquire); next ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
a7a79f28a8fe288ec92593835583160f455707ad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7a79f28a8fe288ec92593835583160f455707ad/tokio/src/task/state.rs
281
340
tokio-rs/tokio:tokio/src/task/state.rs:9
Ok(_) => { return Ok(Snapshot(next)); } Err(actual) => { prev = actual; } } } } /// Store the join waker. pub(super) fn store_join_waker(&self) -> Snapshot { use crate::loom::sync::atomic; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
a7a79f28a8fe288ec92593835583160f455707ad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7a79f28a8fe288ec92593835583160f455707ad/tokio/src/task/state.rs
321
380
tokio-rs/tokio:tokio/src/task/state.rs:7
/// Transition the state to `Scheduled`. /// /// Returns `true` if the task needs to be submitted to the pool for /// execution pub(super) fn transition_to_notified(&self) -> bool { const MASK: usize = RUNNING | NOTIFIED | COMPLETE | CANCELLED; let prev = self.val.fetch_or(NOTIFIED, Rel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/task/state.rs
241
300
tokio-rs/tokio:tokio/src/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); /// The task is currently being run. const RUNNIN...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/state.rs
1
60
tokio-rs/tokio:tokio/src/task/state.rs:2
/// Bits used by the waker ref count portion of the state. /// /// Ref counts only cover **wakers**. Other handles are tracked with other state /// bits. const WAKER_COUNT_MASK: usize = usize::MAX - LIFECYCLE_MASK; /// Number of positions to shift the ref count const WAKER_COUNT_SHIFT: usize = WAKER_COUNT_MASK.count_z...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/state.rs
41
100
tokio-rs/tokio:tokio/src/task/state.rs:3
/// /// Returns a snapshot of the state **after** the transition. pub(super) fn transition_to_running(&self) -> Snapshot { const DELTA: usize = RUNNING | NOTIFIED; let prev = Snapshot(self.val.fetch_xor(DELTA, Acquire)); debug_assert!(prev.is_notified()); if prev.is_running() {...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/state.rs
81
140
tokio-rs/tokio:tokio/src/task/state.rs:4
} let next = Snapshot(prev.0 ^ DELTA); debug_assert!(!next.is_running()); next } /// Transition the task from `Running` -> `Complete`. /// /// Returns a snapshot of the state **after** the transition. pub(super) fn transition_to_complete(&self) -> Snapshot { const...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/state.rs
121
180
tokio-rs/tokio:tokio/src/task/state.rs:5
debug_assert!(!next.is_running()); debug_assert!(next.is_complete()); debug_assert!(next.is_released()); next } /// Transition the task to the canceled state. /// /// Returns the snapshot of the state **after** the transition **if** the /// transition was made successfully ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/state.rs
161
220
tokio-rs/tokio:tokio/src/task/state.rs:6
if prev.is_running() { next.0 -= RUNNING; next.0 |= NOTIFIED; } else if prev.is_notified() { next.0 += RUNNING; next.0 |= NOTIFIED; } else { next.0 |= CANCELLED; } let res = self.val.compare_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/state.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/task/state.rs
201
260