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/mod.rs:6
/// [`tokio::run`]: fn.run.html #[derive(Debug)] pub struct Runtime { /// Task executor kind: Kind, /// Handle to runtime, also contains driver handles handle: Handle, /// Blocking pool handle, used to signal shutdown blocking_pool: BlockingPool, } /// The runtime executor is either a thread-...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/runtime/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/mod.rs:8
/// ``` /// use tokio::runtime::Runtime; /// /// # fn dox() { /// // Create the runtime /// let rt = Runtime::new().unwrap(); /// /// // Spawn a future onto the runtime /// rt.spawn(async { /// println!("now running on a worker thread"); /// }); /// # } /// ``` //...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/runtime/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/mod.rs:9
/// /// # Panics /// /// This function panics if the executor is at capacity, if the provided /// future panics, or if called within an asynchronous execution context. pub fn block_on<F: Future>(&mut self, future: F) -> F::Output { let kind = &mut self.kind; self.handle.enter(|| mat...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/runtime/mod.rs
321
365
tokio-rs/tokio:tokio/src/runtime/mod.rs:4
//! //! [driver]: tokio::net::driver //! [executor]: https://tokio.rs/docs/internals/runtime-model/#executors //! [`Runtime`]: struct.Runtime.html //! [`Reactor`]: ../reactor/struct.Reactor.html //! [`run`]: fn.run.html //! [`tokio::spawn`]: ../executor/fn.spawn.html //! [`tokio::main`]: ../../tokio_macros/attr.main.ht...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
3f0eabe7798de624f5ee9c7562803bfb97e6088f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/src/runtime/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/mod.rs:4
//! //! [driver]: tokio::net::driver //! [executor]: https://tokio.rs/docs/internals/runtime-model/#executors //! [`Runtime`]: struct.Runtime.html //! [`Reactor`]: ../reactor/struct.Reactor.html //! [`run`]: fn.run.html //! [`tokio::spawn`]: ../executor/fn.spawn.html //! [`tokio::main`]: ../../tokio_macros/attr.main.ht...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
1474794055e291c544c3c95d6381d549cefbd7d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1474794055e291c544c3c95d6381d549cefbd7d5/tokio/src/runtime/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/mod.rs:6
/// [`tokio::run`]: fn.run.html #[derive(Debug)] pub struct Runtime { /// Task executor kind: Kind, /// Handle to runtime, also contains driver handles handle: Handle, /// Blocking pool handle, used to signal shutdown blocking_pool: BlockingPool, } /// The runtime executor is either a thread-...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
1474794055e291c544c3c95d6381d549cefbd7d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1474794055e291c544c3c95d6381d549cefbd7d5/tokio/src/runtime/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/mod.rs:8
/// ``` /// use tokio::runtime::Runtime; /// /// # fn dox() { /// // Create the runtime /// let rt = Runtime::new().unwrap(); /// /// // Spawn a future onto the runtime /// rt.spawn(async { /// println!("now running on a worker thread"); /// }); /// # } /// ``` //...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
1474794055e291c544c3c95d6381d549cefbd7d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1474794055e291c544c3c95d6381d549cefbd7d5/tokio/src/runtime/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/mod.rs:9
/// /// # Panics /// /// This function panics if the executor is at capacity, if the provided /// future panics, or if called within an asynchronous execution context. pub fn block_on<F: Future>(&mut self, future: F) -> F::Output { let kind = &mut self.kind; self.handle.enter(|| mat...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
1474794055e291c544c3c95d6381d549cefbd7d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1474794055e291c544c3c95d6381d549cefbd7d5/tokio/src/runtime/mod.rs
321
365
tokio-rs/tokio:tokio/src/runtime/mod.rs:8
/// ``` /// use tokio::runtime::Runtime; /// /// # fn dox() { /// // Create the runtime /// let rt = Runtime::new().unwrap(); /// /// // Spawn a future onto the runtime /// rt.spawn(async { /// println!("now running on a worker thread"); /// }); /// # } /// ``` //...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/mod.rs:9
/// # Panics /// /// This function panics if the executor is at capacity, if the provided /// future panics, or if called within an asynchronous execution context. pub fn block_on<F: Future>(&mut self, future: F) -> F::Output { let kind = &mut self.kind; self.handle.enter(|| match kind ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/mod.rs
321
364
tokio-rs/tokio:tokio/src/runtime/mod.rs:8
/// ``` /// use tokio::runtime::Runtime; /// /// # fn dox() { /// // Create the runtime /// let rt = Runtime::new().unwrap(); /// /// // Spawn a future onto the runtime /// rt.spawn(async { /// println!("now running on a worker thread"); /// }); /// # } /// ``` //...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/mod.rs:9
/// # Panics /// /// This function panics if the executor is at capacity, if the provided /// future panics, or if called within an asynchronous execution context. pub fn block_on<F: Future>(&mut self, future: F) -> F::Output { let kind = &mut self.kind; self.handle.enter(|| match kind ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/mod.rs
321
356
tokio-rs/tokio:tokio/src/runtime/mod.rs:4
//! //! [driver]: tokio::net::driver //! [executor]: https://tokio.rs/docs/internals/runtime-model/#executors //! [timer]: ../timer/index.html //! [`Runtime`]: struct.Runtime.html //! [`Reactor`]: ../reactor/struct.Reactor.html //! [`run`]: fn.run.html //! [`tokio::spawn`]: ../executor/fn.spawn.html //! [`tokio::main`]...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/mod.rs:5
mod park; pub use self::park::{Park, Unpark}; #[cfg(feature = "rt-current-thread")] mod spawner; #[cfg(feature = "rt-current-thread")] pub use self::spawner::Spawner; #[cfg(feature = "rt-current-thread")] mod task; #[cfg(feature = "rt-current-thread")] pub use self::task::{JoinError, JoinHandle}; mod timer; #[cfg(f...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/mod.rs:6
/// Once the reactor has dropped, any outstanding I/O resources bound to /// that reactor will no longer function. Calling any method on them will /// result in an error. /// /// [mod]: index.html /// [`new`]: #method.new /// [`Builder`]: struct.Builder.html /// [`tokio::run`]: fn.run.html #[derive(Debug)] pub struct R...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/mod.rs:8
/// /// This spawns the given future onto the runtime's executor, usually a /// thread pool. The thread pool is then responsible for polling the future /// until it completes. /// /// See [module level][mod] documentation for more details. /// /// [mod]: index.html /// /// # Examples...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/mod.rs:9
} /// Run a future to completion on the Tokio runtime. This is the runtime's /// entry point. /// /// This runs the given future on the runtime, blocking until it is /// complete, and yielding its resolved result. Any tasks or timers which /// the future spawns internally will be executed on th...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/mod.rs
321
378
tokio-rs/tokio:tokio/src/runtime/mod.rs:10
/// let rt = Runtime::new() /// .unwrap(); /// /// let spawner = rt.spawner(); /// /// spawner.spawn(async { println!("hello"); }); /// ``` #[cfg(feature = "rt-current-thread")] pub fn spawner(&self) -> Spawner { match &self.kind { Kind::Shell => Spawner::shell(),...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/mod.rs
361
378
tokio-rs/tokio:tokio/src/runtime/mod.rs:4
//! //! [driver]: tokio::net::driver //! [executor]: https://tokio.rs/docs/internals/runtime-model/#executors //! [timer]: ../timer/index.html //! [`Runtime`]: struct.Runtime.html //! [`Reactor`]: ../reactor/struct.Reactor.html //! [`run`]: fn.run.html //! [`tokio::spawn`]: ../executor/fn.spawn.html //! [`tokio::main`]...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2/tokio/src/runtime/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/mod.rs:5
mod spawner; #[cfg(feature = "rt-current-thread")] pub use self::spawner::Spawner; #[cfg(feature = "rt-current-thread")] mod task; #[cfg(feature = "rt-current-thread")] pub use self::task::{JoinError, JoinHandle}; mod timer; #[cfg(feature = "rt-full")] pub(crate) mod thread_pool; #[cfg(feature = "blocking")] use cr...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2/tokio/src/runtime/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/mod.rs:6
/// /// Once the reactor has dropped, any outstanding I/O resources bound to /// that reactor will no longer function. Calling any method on them will /// result in an error. /// /// [mod]: index.html /// [`new`]: #method.new /// [`Builder`]: struct.Builder.html /// [`tokio::run`]: fn.run.html #[derive(Debug)] pub stru...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2/tokio/src/runtime/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/mod.rs:8
/// Spawn a future onto the Tokio runtime. /// /// This spawns the given future onto the runtime's executor, usually a /// thread pool. The thread pool is then responsible for polling the future /// until it completes. /// /// See [module level][mod] documentation for more details. /// /...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2/tokio/src/runtime/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/mod.rs:9
} } /// Run a future to completion on the Tokio runtime. This is the runtime's /// entry point. /// /// This runs the given future on the runtime, blocking until it is /// complete, and yielding its resolved result. Any tasks or timers which /// the future spawns internally will be executed...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2/tokio/src/runtime/mod.rs
321
379
tokio-rs/tokio:tokio/src/runtime/mod.rs:10
/// /// let rt = Runtime::new() /// .unwrap(); /// /// let spawner = rt.spawner(); /// /// spawner.spawn(async { println!("hello"); }); /// ``` #[cfg(feature = "rt-current-thread")] pub fn spawner(&self) -> Spawner { match &self.kind { Kind::Shell => Spawner::...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2/tokio/src/runtime/mod.rs
361
379
tokio-rs/tokio:tokio/src/runtime/mod.rs:4
//! //! [driver]: tokio::net::driver //! [executor]: https://tokio.rs/docs/internals/runtime-model/#executors //! [timer]: ../timer/index.html //! [`Runtime`]: struct.Runtime.html //! [`Reactor`]: ../reactor/struct.Reactor.html //! [`run`]: fn.run.html //! [`tokio::spawn`]: ../executor/fn.spawn.html //! [`tokio::main`]...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
d5c1119c881c9a8b511aa9000fd26b9bda014256
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/runtime/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/mod.rs:5
pub use self::spawner::Spawner; #[cfg(feature = "rt-current-thread")] mod task; #[cfg(feature = "rt-current-thread")] pub use self::task::{JoinError, JoinHandle}; mod timer; #[cfg(feature = "rt-full")] pub(crate) mod thread_pool; #[cfg(feature = "blocking")] use crate::runtime::blocking::PoolWaiter; #[cfg(feature =...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
d5c1119c881c9a8b511aa9000fd26b9bda014256
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/runtime/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/mod.rs:6
/// that reactor will no longer function. Calling any method on them will /// result in an error. /// /// [mod]: index.html /// [`new`]: #method.new /// [`Builder`]: struct.Builder.html /// [`tokio::run`]: fn.run.html #[derive(Debug)] pub struct Runtime { /// Task executor kind: Kind, /// Handles to the ne...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
d5c1119c881c9a8b511aa9000fd26b9bda014256
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/runtime/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/mod.rs:8
/// This spawns the given future onto the runtime's executor, usually a /// thread pool. The thread pool is then responsible for polling the future /// until it completes. /// /// See [module level][mod] documentation for more details. /// /// [mod]: index.html /// /// # Examples ///...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
d5c1119c881c9a8b511aa9000fd26b9bda014256
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/runtime/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/mod.rs:9
/// Run a future to completion on the Tokio runtime. This is the runtime's /// entry point. /// /// This runs the given future on the runtime, blocking until it is /// complete, and yielding its resolved result. Any tasks or timers which /// the future spawns internally will be executed on the runti...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
d5c1119c881c9a8b511aa9000fd26b9bda014256
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/runtime/mod.rs
321
380
tokio-rs/tokio:tokio/src/runtime/mod.rs:10
/// use tokio::runtime::Runtime; /// /// let rt = Runtime::new() /// .unwrap(); /// /// let spawner = rt.spawner(); /// /// spawner.spawn(async { println!("hello"); }); /// ``` #[cfg(feature = "rt-current-thread")] pub fn spawner(&self) -> Spawner { match &self.kind {...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/runtime/mod.rs
MIT
d5c1119c881c9a8b511aa9000fd26b9bda014256
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/runtime/mod.rs
361
380
tokio-rs/tokio:tokio/src/runtime/park.rs:1
#![cfg_attr(not(feature = "full"), allow(dead_code))] use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::{Arc, Condvar, Mutex}; use std::sync::atomic::Ordering::SeqCst; use std::time::Duration; #[derive(Debug)] pub(crate) struct ParkThread { inner: Arc<Inner>, } /// Unblocks a thread that was bl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/park.rs
1
60
tokio-rs/tokio:tokio/src/runtime/park.rs:2
// ==== impl ParkThread ==== impl ParkThread { pub(crate) fn new() -> Self { Self { inner: Arc::new(Inner { state: AtomicUsize::new(EMPTY), mutex: Mutex::new(()), condvar: Condvar::new(), }), } } pub(crate) fn unpark(&...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/park.rs
41
100
tokio-rs/tokio:tokio/src/runtime/park.rs:3
// return quickly. if self .state .compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) .is_ok() { return; } // Otherwise we need to coordinate going to sleep let mut m = self.mutex.lock(); match self.state.compare_exchange(E...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/park.rs
81
140
tokio-rs/tokio:tokio/src/runtime/park.rs:4
// spurious wakeup, go back to sleep } } /// Parks the current thread for at most `dur`. fn park_timeout(&self, dur: Duration) { // Like `park` above we have a fast path for an already-notified thread, // and afterwards we start coordinating for a sleep. Return quickly. if s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/park.rs
121
180
tokio-rs/tokio:tokio/src/runtime/park.rs:5
let (_m, _result) = self.condvar.wait_timeout(m, dur).unwrap(); #[cfg(all(target_family = "wasm", not(target_feature = "atomics")))] // Wasm without atomics doesn't have threads, so just sleep. { let _m = m; std::thread::sleep(dur); } match self.state.sw...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/park.rs
161
220
tokio-rs/tokio:tokio/src/runtime/park.rs:6
drop(self.mutex.lock()); self.condvar.notify_one(); } fn shutdown(&self) { self.condvar.notify_all(); } } impl Default for ParkThread { fn default() -> Self { Self::new() } } // ===== impl UnparkThread ===== impl UnparkThread { pub(crate) fn unpark(&self) { s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/park.rs
201
260
tokio-rs/tokio:tokio/src/runtime/park.rs:7
/// the thread that the caller intends to park. pub(crate) fn new() -> CachedParkThread { CachedParkThread { _anchor: PhantomData, } } pub(crate) fn waker(&self) -> Result<Waker, AccessError> { self.unpark().map(UnparkThread::into_waker) } fn unpark(&self) -> Re...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/park.rs
241
300
tokio-rs/tokio:tokio/src/runtime/park.rs:8
pin!(f); loop { if let Ready(v) = crate::task::coop::budget(|| f.as_mut().poll(&mut cx)) { return Ok(v); } self.park(); } } } impl UnparkThread { pub(crate) fn into_waker(self) -> Waker { unsafe { let raw = unparker_to_ra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/park.rs
281
340
tokio-rs/tokio:tokio/src/runtime/park.rs:9
) } /// # Safety /// /// The pointer must have been created by [`Inner::into_raw`]. unsafe fn clone(raw: *const ()) -> RawWaker { unsafe { Arc::increment_strong_count(raw as *const Inner); } unsafe { unparker_to_raw_waker(Inner::from_raw(raw)) } } /// # Safety /// /// The pointer must have been cr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/park.rs
321
362
tokio-rs/tokio:tokio/src/runtime/park.rs:8
pin!(f); loop { if let Ready(v) = crate::task::coop::budget(|| f.as_mut().poll(&mut cx)) { return Ok(v); } self.park(); } } } impl UnparkThread { pub(crate) fn into_waker(self) -> Waker { unsafe { let raw = unparker_to_ra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/park.rs
281
340
tokio-rs/tokio:tokio/src/runtime/park.rs:8
pin!(f); loop { if let Ready(v) = crate::task::coop::budget(|| f.as_mut().poll(&mut cx)) { return Ok(v); } self.park(); } } } impl UnparkThread { pub(crate) fn into_waker(self) -> Waker { unsafe { let raw = unparker_to_ra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
f490029b8fc4552d54b527fc0052fb539e493ebf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f490029b8fc4552d54b527fc0052fb539e493ebf/tokio/src/runtime/park.rs
281
340
tokio-rs/tokio:tokio/src/runtime/park.rs:9
Arc::increment_strong_count(raw as *const Inner); unparker_to_raw_waker(Inner::from_raw(raw)) } unsafe fn drop_waker(raw: *const ()) { drop(Inner::from_raw(raw)); } unsafe fn wake(raw: *const ()) { let unparker = Inner::from_raw(raw); unparker.unpark(); } unsafe fn wake_by_ref(raw: *const ()) { l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
f490029b8fc4552d54b527fc0052fb539e493ebf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f490029b8fc4552d54b527fc0052fb539e493ebf/tokio/src/runtime/park.rs
321
342
tokio-rs/tokio:tokio/src/runtime/park.rs:1
#![cfg_attr(not(feature = "full"), allow(dead_code))] use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::{Arc, Condvar, Mutex}; use crate::util::{waker, Wake}; use std::sync::atomic::Ordering::SeqCst; use std::time::Duration; #[derive(Debug)] pub(crate) struct ParkThread { inner: Arc<Inner>, } /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1/tokio/src/runtime/park.rs
1
60
tokio-rs/tokio:tokio/src/runtime/park.rs:2
// ==== impl ParkThread ==== impl ParkThread { pub(crate) fn new() -> Self { Self { inner: Arc::new(Inner { state: AtomicUsize::new(EMPTY), mutex: Mutex::new(()), condvar: Condvar::new(), }), } } pub(crate) fn unpark(&...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1/tokio/src/runtime/park.rs
41
100
tokio-rs/tokio:tokio/src/runtime/park.rs:3
// If we were previously notified then we consume this notification and // return quickly. if self .state .compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) .is_ok() { return; } // Otherwise we need to coordinate going to sleep ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1/tokio/src/runtime/park.rs
81
140
tokio-rs/tokio:tokio/src/runtime/park.rs:4
} // spurious wakeup, go back to sleep } } /// Parks the current thread for at most `dur`. fn park_timeout(&self, dur: Duration) { // Like `park` above we have a fast path for an already-notified thread, // and afterwards we start coordinating for a sleep. Return quickl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1/tokio/src/runtime/park.rs
121
180
tokio-rs/tokio:tokio/src/runtime/park.rs:5
// parked. let (_m, _result) = self.condvar.wait_timeout(m, dur).unwrap(); #[cfg(all(target_family = "wasm", not(target_feature = "atomics")))] // Wasm without atomics doesn't have threads, so just sleep. { let _m = m; std::thread::sleep(dur); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1/tokio/src/runtime/park.rs
161
220
tokio-rs/tokio:tokio/src/runtime/park.rs:6
// to release `lock`. drop(self.mutex.lock()); self.condvar.notify_one(); } fn shutdown(&self) { self.condvar.notify_all(); } } impl Default for ParkThread { fn default() -> Self { Self::new() } } // ===== impl UnparkThread ===== impl UnparkThread { pub(crate...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1/tokio/src/runtime/park.rs
201
260
tokio-rs/tokio:tokio/src/runtime/park.rs:7
/// This type cannot be moved to other threads, so it should be created on /// the thread that the caller intends to park. pub(crate) fn new() -> CachedParkThread { CachedParkThread { _anchor: PhantomData, } } pub(crate) fn waker(&self) -> Result<Waker, AccessError> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1/tokio/src/runtime/park.rs
241
300
tokio-rs/tokio:tokio/src/runtime/park.rs:8
pin!(f); loop { if let Ready(v) = crate::task::coop::budget(|| f.as_mut().poll(&mut cx)) { return Ok(v); } self.park(); } } } impl UnparkThread { pub(crate) fn into_waker(self) -> Waker { waker(self.inner) } } impl Wake for Inne...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1/tokio/src/runtime/park.rs
281
313
tokio-rs/tokio:tokio/src/runtime/park.rs:7
/// the thread that the caller intends to park. pub(crate) fn new() -> CachedParkThread { CachedParkThread { _anchor: PhantomData, } } pub(crate) fn waker(&self) -> Result<Waker, AccessError> { self.unpark().map(UnparkThread::into_waker) } fn unpark(&self) -> Re...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
a1520f5525fac7af19d75b1eec0740bf3d9b97dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a1520f5525fac7af19d75b1eec0740bf3d9b97dc/tokio/src/runtime/park.rs
241
300
tokio-rs/tokio:tokio/src/runtime/park.rs:8
pin!(f); loop { if let Ready(v) = crate::runtime::coop::budget(|| f.as_mut().poll(&mut cx)) { return Ok(v); } self.park(); } } } impl UnparkThread { pub(crate) fn into_waker(self) -> Waker { unsafe { let raw = unparker_to...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
a1520f5525fac7af19d75b1eec0740bf3d9b97dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a1520f5525fac7af19d75b1eec0740bf3d9b97dc/tokio/src/runtime/park.rs
281
340
tokio-rs/tokio:tokio/src/runtime/park.rs:2
// ==== impl ParkThread ==== impl ParkThread { pub(crate) fn new() -> Self { Self { inner: Arc::new(Inner { state: AtomicUsize::new(EMPTY), mutex: Mutex::new(()), condvar: Condvar::new(), }), } } pub(crate) fn unpark(&...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/park.rs
41
100
tokio-rs/tokio:tokio/src/runtime/park.rs:3
// ==== impl Inner ==== impl Inner { fn park(&self) { // If we were previously notified then we consume this notification and // return quickly. if self .state .compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) .is_ok() { return; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/park.rs
81
140
tokio-rs/tokio:tokio/src/runtime/park.rs:4
.is_ok() { // got a notification return; } // spurious wakeup, go back to sleep } } /// Parks the current thread for at most `dur`. fn park_timeout(&self, dur: Duration) { // Like `park` above we have a fast path for an al...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/park.rs
121
180
tokio-rs/tokio:tokio/src/runtime/park.rs:5
// Wait with a timeout, and if we spuriously wake up or otherwise wake up // from a notification, we just want to unconditionally set the state back to // empty, either consuming a notification or un-flagging ourselves as // parked. let (_m, _result) = self.condvar.wait_timeout(m, dur).u...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/park.rs
161
220
tokio-rs/tokio:tokio/src/runtime/park.rs:6
} fn shutdown(&self) { self.condvar.notify_all(); } } impl Default for ParkThread { fn default() -> Self { Self::new() } } // ===== impl UnparkThread ===== impl UnparkThread { pub(crate) fn unpark(&self) { self.inner.unpark(); } } use crate::loom::thread::AccessError...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/park.rs
201
260
tokio-rs/tokio:tokio/src/runtime/park.rs:7
_anchor: PhantomData, } } pub(crate) fn waker(&self) -> Result<Waker, AccessError> { self.unpark().map(UnparkThread::into_waker) } fn unpark(&self) -> Result<UnparkThread, AccessError> { self.with_current(ParkThread::unpark) } pub(crate) fn park(&mut self) { se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/park.rs
241
300
tokio-rs/tokio:tokio/src/runtime/park.rs:8
if let Ready(v) = crate::runtime::coop::budget(|| f.as_mut().poll(&mut cx)) { return Ok(v); } self.park(); } } } impl UnparkThread { pub(crate) fn into_waker(self) -> Waker { unsafe { let raw = unparker_to_raw_waker(self.inner); W...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/park.rs
281
339
tokio-rs/tokio:tokio/src/runtime/park.rs:9
unsafe fn drop_waker(raw: *const ()) { drop(Inner::from_raw(raw)); } unsafe fn wake(raw: *const ()) { let unparker = Inner::from_raw(raw); unparker.unpark(); } unsafe fn wake_by_ref(raw: *const ()) { let raw = raw as *const Inner; (*raw).unpark(); } #[cfg(loom)] pub(crate) fn current_thread_park_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/runtime/park.rs
321
339
tokio-rs/tokio:tokio/src/runtime/park.rs:3
// ==== impl Inner ==== impl Inner { fn park(&self) { // If we were previously notified then we consume this notification and // return quickly. if self .state .compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) .is_ok() { return; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
1e286689ffc533a2d08c2f30c55ad46f9c3c5b93
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e286689ffc533a2d08c2f30c55ad46f9c3c5b93/tokio/src/runtime/park.rs
81
140
tokio-rs/tokio:tokio/src/runtime/park.rs:4
.is_ok() { // got a notification return; } // spurious wakeup, go back to sleep } } /// Parks the current thread for at most `dur`. fn park_timeout(&self, dur: Duration) { // Like `park` above we have a fast path for an al...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
1e286689ffc533a2d08c2f30c55ad46f9c3c5b93
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e286689ffc533a2d08c2f30c55ad46f9c3c5b93/tokio/src/runtime/park.rs
121
180
tokio-rs/tokio:tokio/src/runtime/park.rs:5
// Wait with a timeout, and if we spuriously wake up or otherwise wake up // from a notification, we just want to unconditionally set the state back to // empty, either consuming a notification or un-flagging ourselves as // parked. let (_m, _result) = self.condvar.wait_timeout(m, dur).u...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
1e286689ffc533a2d08c2f30c55ad46f9c3c5b93
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e286689ffc533a2d08c2f30c55ad46f9c3c5b93/tokio/src/runtime/park.rs
161
220
tokio-rs/tokio:tokio/src/runtime/park.rs:1
#![cfg_attr(not(feature = "full"), allow(dead_code))] use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::{Arc, Condvar, Mutex}; use std::sync::atomic::Ordering::SeqCst; use std::time::Duration; #[derive(Debug)] pub(crate) struct ParkThread { inner: Arc<Inner>, } /// Unblocks a thread that was bl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
4846959e8a534cf2aff63f8613e5f69a7d2ce5f8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4846959e8a534cf2aff63f8613e5f69a7d2ce5f8/tokio/src/runtime/park.rs
1
60
tokio-rs/tokio:tokio/src/runtime/park.rs:7
_anchor: PhantomData, } } pub(crate) fn waker(&self) -> Result<Waker, AccessError> { self.unpark().map(UnparkThread::into_waker) } fn unpark(&self) -> Result<UnparkThread, AccessError> { self.with_current(ParkThread::unpark) } pub(crate) fn park(&mut self) { se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
3ac4cfb68a6ac8940a71d29b328a35461195fc45
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3ac4cfb68a6ac8940a71d29b328a35461195fc45/tokio/src/runtime/park.rs
241
300
tokio-rs/tokio:tokio/src/runtime/park.rs:8
loop { if let Ready(v) = crate::runtime::coop::budget(|| f.as_mut().poll(&mut cx)) { return Ok(v); } self.park(); } } } impl UnparkThread { pub(crate) fn into_waker(self) -> Waker { unsafe { let raw = unparker_to_raw_waker(self.in...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
3ac4cfb68a6ac8940a71d29b328a35461195fc45
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3ac4cfb68a6ac8940a71d29b328a35461195fc45/tokio/src/runtime/park.rs
281
340
tokio-rs/tokio:tokio/src/runtime/park.rs:9
} unsafe fn drop_waker(raw: *const ()) { drop(Inner::from_raw(raw)); } unsafe fn wake(raw: *const ()) { let unparker = Inner::from_raw(raw); unparker.unpark(); } unsafe fn wake_by_ref(raw: *const ()) { let raw = raw as *const Inner; (*raw).unpark(); } #[cfg(loom)] pub(crate) fn current_thread_pa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
3ac4cfb68a6ac8940a71d29b328a35461195fc45
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3ac4cfb68a6ac8940a71d29b328a35461195fc45/tokio/src/runtime/park.rs
321
340
tokio-rs/tokio:tokio/src/runtime/park.rs:2
// ==== impl ParkThread ==== impl ParkThread { pub(crate) fn new() -> Self { Self { inner: Arc::new(Inner { state: AtomicUsize::new(EMPTY), mutex: Mutex::new(()), condvar: Condvar::new(), }), } } pub(crate) fn unpark(&...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/park.rs
41
100
tokio-rs/tokio:tokio/src/runtime/park.rs:3
// ==== impl Inner ==== impl Inner { /// Parks the current thread for at most `dur`. fn park(&self) { // If we were previously notified then we consume this notification and // return quickly. if self .state .compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/park.rs
81
140
tokio-rs/tokio:tokio/src/runtime/park.rs:4
.compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) .is_ok() { // got a notification return; } // spurious wakeup, go back to sleep } } fn park_timeout(&self, dur: Duration) { // Like `park` above we have a fast...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/park.rs
121
180
tokio-rs/tokio:tokio/src/runtime/park.rs:5
// Wait with a timeout, and if we spuriously wake up or otherwise wake up // from a notification, we just want to unconditionally set the state back to // empty, either consuming a notification or un-flagging ourselves as // parked. let (_m, _result) = self.condvar.wait_timeout(m, dur).u...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/park.rs
161
220
tokio-rs/tokio:tokio/src/runtime/park.rs:6
} fn shutdown(&self) { self.condvar.notify_all(); } } impl Default for ParkThread { fn default() -> Self { Self::new() } } // ===== impl UnparkThread ===== impl UnparkThread { pub(crate) fn unpark(&self) { self.inner.unpark(); } } use crate::loom::thread::AccessError...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/park.rs
201
260
tokio-rs/tokio:tokio/src/runtime/park.rs:7
_anchor: PhantomData, } } pub(crate) fn waker(&self) -> Result<Waker, AccessError> { self.unpark().map(|unpark| unpark.into_waker()) } fn unpark(&self) -> Result<UnparkThread, AccessError> { self.with_current(|park_thread| park_thread.unpark()) } pub(crate) fn park(&mu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/park.rs
241
300
tokio-rs/tokio:tokio/src/runtime/park.rs:2
// ==== impl ParkThread ==== impl ParkThread { pub(crate) fn new() -> Self { Self { inner: Arc::new(Inner { state: AtomicUsize::new(EMPTY), mutex: Mutex::new(()), condvar: Condvar::new(), }), } } pub(crate) fn unpark(&...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
267a23158151b6b1e78d5d547fa9455217f79b3c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/267a23158151b6b1e78d5d547fa9455217f79b3c/tokio/src/runtime/park.rs
41
100
tokio-rs/tokio:tokio/src/runtime/park.rs:6
} fn shutdown(&self) { self.condvar.notify_all(); } } impl Default for ParkThread { fn default() -> Self { Self::new() } } // ===== impl UnparkThread ===== impl UnparkThread { pub(crate) fn unpark(&self) { self.inner.unpark(); } } use crate::loom::thread::AccessError...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c748f4965eae883a2291945116d84cab5d657100
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/src/runtime/park.rs
201
260
tokio-rs/tokio:tokio/src/runtime/park.rs:7
CachedParkThread { _anchor: PhantomData, } } pub(crate) fn waker(&self) -> Result<Waker, AccessError> { self.unpark().map(|unpark| unpark.into_waker()) } fn unpark(&self) -> Result<UnparkThread, AccessError> { self.with_current(|park_thread| park_thread.unpark()) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c748f4965eae883a2291945116d84cab5d657100
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/src/runtime/park.rs
241
300
tokio-rs/tokio:tokio/src/runtime/park.rs:8
loop { if let Ready(v) = crate::runtime::coop::budget(|| f.as_mut().poll(&mut cx)) { return Ok(v); } self.park(); } } } impl UnparkThread { pub(crate) fn into_waker(self) -> Waker { unsafe { let raw = unparker_to_raw_waker(self.in...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c748f4965eae883a2291945116d84cab5d657100
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/src/runtime/park.rs
281
340
tokio-rs/tokio:tokio/src/runtime/park.rs:9
// Increment the ref count mem::forget(unparker.clone()); unparker_to_raw_waker(unparker) } unsafe fn drop_waker(raw: *const ()) { let _ = Inner::from_raw(raw); } unsafe fn wake(raw: *const ()) { let unparker = Inner::from_raw(raw); unparker.unpark(); } unsafe fn wake_by_ref(raw: *const ()) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c748f4965eae883a2291945116d84cab5d657100
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/src/runtime/park.rs
321
348
tokio-rs/tokio:tokio/src/runtime/park.rs:7
CachedParkThread { _anchor: PhantomData, } } pub(crate) fn waker(&self) -> Result<Waker, AccessError> { self.unpark().map(|unpark| unpark.into_waker()) } fn unpark(&self) -> Result<UnparkThread, AccessError> { self.with_current(|park_thread| park_thread.unpark()) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
22862739dddd49a94065aa7a917cde2dc8a3f6bc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/22862739dddd49a94065aa7a917cde2dc8a3f6bc/tokio/src/runtime/park.rs
241
300
tokio-rs/tokio:tokio/src/runtime/park.rs:8
loop { if let Ready(v) = crate::runtime::coop::budget(|| f.as_mut().poll(&mut cx)) { return Ok(v); } // Wake any yielded tasks before parking in order to avoid // blocking. #[cfg(feature = "rt")] crate::runtime::context::with_defer...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
22862739dddd49a94065aa7a917cde2dc8a3f6bc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/22862739dddd49a94065aa7a917cde2dc8a3f6bc/tokio/src/runtime/park.rs
281
340
tokio-rs/tokio:tokio/src/runtime/park.rs:9
) } unsafe fn clone(raw: *const ()) -> RawWaker { let unparker = Inner::from_raw(raw); // Increment the ref count mem::forget(unparker.clone()); unparker_to_raw_waker(unparker) } unsafe fn drop_waker(raw: *const ()) { let _ = Inner::from_raw(raw); } unsafe fn wake(raw: *const ()) { let unpa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
22862739dddd49a94065aa7a917cde2dc8a3f6bc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/22862739dddd49a94065aa7a917cde2dc8a3f6bc/tokio/src/runtime/park.rs
321
353
tokio-rs/tokio:tokio/src/runtime/park.rs:1
//! Parks the runtime. //! //! A combination of the various resource driver park handles. use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::{Arc, Condvar, Mutex}; use crate::loom::thread; use crate::park::{Park, Unpark}; use crate::runtime::driver::Driver; use crate::util::TryLock; use std::sync::ato...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
444660664b96f758610a0e7201a6a1a31a0f2405
github
async-runtime
https://github.com/tokio-rs/tokio/blob/444660664b96f758610a0e7201a6a1a31a0f2405/tokio/src/runtime/park.rs
1
60
tokio-rs/tokio:tokio/src/runtime/park.rs:2
/// Shared across multiple Parker handles struct Shared { /// Shared driver. Only one thread at a time can use this driver: TryLock<Driver>, /// Unpark handle handle: <Driver as Park>::Unpark, } impl Parker { pub(crate) fn new(driver: Driver) -> Parker { let handle = driver.unpark(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
444660664b96f758610a0e7201a6a1a31a0f2405
github
async-runtime
https://github.com/tokio-rs/tokio/blob/444660664b96f758610a0e7201a6a1a31a0f2405/tokio/src/runtime/park.rs
41
100
tokio-rs/tokio:tokio/src/runtime/park.rs:3
impl Park for Parker { type Unpark = Unparker; type Error = (); fn unpark(&self) -> Unparker { Unparker { inner: self.inner.clone(), } } fn park(&mut self) -> Result<(), Self::Error> { self.inner.park(); Ok(()) } fn park_timeout(&mut self, durat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
444660664b96f758610a0e7201a6a1a31a0f2405
github
async-runtime
https://github.com/tokio-rs/tokio/blob/444660664b96f758610a0e7201a6a1a31a0f2405/tokio/src/runtime/park.rs
81
140
tokio-rs/tokio:tokio/src/runtime/park.rs:4
fn park(&self) { for _ in 0..3 { // If we were previously notified then we consume this notification and // return quickly. if self .state .compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) .is_ok() { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
444660664b96f758610a0e7201a6a1a31a0f2405
github
async-runtime
https://github.com/tokio-rs/tokio/blob/444660664b96f758610a0e7201a6a1a31a0f2405/tokio/src/runtime/park.rs
121
180
tokio-rs/tokio:tokio/src/runtime/park.rs:5
return; } Err(actual) => panic!("inconsistent park state; actual = {}", actual), } loop { m = self.condvar.wait(m).unwrap(); if self .state .compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) .is_ok() ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
444660664b96f758610a0e7201a6a1a31a0f2405
github
async-runtime
https://github.com/tokio-rs/tokio/blob/444660664b96f758610a0e7201a6a1a31a0f2405/tokio/src/runtime/park.rs
161
220
tokio-rs/tokio:tokio/src/runtime/park.rs:6
Err(actual) => panic!("inconsistent park state; actual = {}", actual), } // TODO: don't unwrap driver.park().unwrap(); match self.state.swap(EMPTY, SeqCst) { NOTIFIED => {} // got a notification, hurray! PARKED_DRIVER => {} // no notification, alas ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
444660664b96f758610a0e7201a6a1a31a0f2405
github
async-runtime
https://github.com/tokio-rs/tokio/blob/444660664b96f758610a0e7201a6a1a31a0f2405/tokio/src/runtime/park.rs
201
257
tokio-rs/tokio:tokio/src/runtime/park.rs:7
drop(self.mutex.lock()); self.condvar.notify_one() } fn unpark_driver(&self) { self.shared.handle.unpark(); } fn shutdown(&self) { if let Some(mut driver) = self.shared.driver.try_lock() { driver.shutdown(); } self.condvar.notify_all(); } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
444660664b96f758610a0e7201a6a1a31a0f2405
github
async-runtime
https://github.com/tokio-rs/tokio/blob/444660664b96f758610a0e7201a6a1a31a0f2405/tokio/src/runtime/park.rs
241
257
tokio-rs/tokio:tokio/src/runtime/park.rs:4
fn park(&self) { for _ in 0..3 { // If we were previously notified then we consume this notification and // return quickly. if self .state .compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) .is_ok() { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/runtime/park.rs
121
180
tokio-rs/tokio:tokio/src/runtime/park.rs:6
Err(actual) => panic!("inconsistent park state; actual = {}", actual), } // TODO: don't unwrap driver.park().unwrap(); match self.state.swap(EMPTY, SeqCst) { NOTIFIED => {} // got a notification, hurray! PARKED_DRIVER => {} // no notification, alas ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/runtime/park.rs
201
257
tokio-rs/tokio:tokio/src/runtime/park.rs:7
drop(self.mutex.lock().unwrap()); self.condvar.notify_one() } fn unpark_driver(&self) { self.shared.handle.unpark(); } fn shutdown(&self) { if let Some(mut driver) = self.shared.driver.try_lock() { driver.shutdown(); } self.condvar.notify_all(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/runtime/park.rs
241
257
tokio-rs/tokio:tokio/src/runtime/park.rs:1
//! Parks the runtime. //! //! A combination of the various resource driver park handles. use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::{Arc, Condvar, Mutex}; use crate::loom::thread; use crate::park::{Park, Unpark}; use crate::runtime::time; use crate::util::TryLock; use std::sync::atomic::Order...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/runtime/park.rs
1
60
tokio-rs/tokio:tokio/src/runtime/park.rs:2
/// Shared across multiple Parker handles struct Shared { /// Shared driver. Only one thread at a time can use this driver: TryLock<time::Driver>, /// Unpark handle handle: <time::Driver as Park>::Unpark, } impl Parker { pub(crate) fn new(driver: time::Driver) -> Parker { let handle = driv...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/runtime/park.rs
41
100
tokio-rs/tokio:tokio/src/runtime/park.rs:5
return; } Err(actual) => panic!("inconsistent park state; actual = {}", actual), } loop { m = self.condvar.wait(m).unwrap(); if self .state .compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) .is_ok() ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/runtime/park.rs
161
220
tokio-rs/tokio:tokio/src/runtime/park.rs:3
impl Park for Parker { type Unpark = Unparker; type Error = (); fn unpark(&self) -> Unparker { Unparker { inner: self.inner.clone(), } } fn park(&mut self) -> Result<(), Self::Error> { self.inner.park(); Ok(()) } fn park_timeout(&mut self, durat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/runtime/park.rs
81
140
tokio-rs/tokio:tokio/src/runtime/park.rs:4
if self .state .compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) .is_ok() { return; } thread::yield_now(); } if let Some(mut driver) = self.shared.driver.try_lock() { self.park_driver(&mut ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/runtime/park.rs
121
180
tokio-rs/tokio:tokio/src/runtime/park.rs:5
} loop { m = self.condvar.wait(m).unwrap(); if self .state .compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) .is_ok() { // got a notification return; } // spurious wake...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/runtime/park.rs
161
220
tokio-rs/tokio:tokio/src/runtime/park.rs:6
driver.park().unwrap(); match self.state.swap(EMPTY, SeqCst) { NOTIFIED => {} // got a notification, hurray! PARKED_DRIVER => {} // no notification, alas n => panic!("inconsistent park_timeout state: {}", n), } } fn unpark(&self) { // To ensure ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/runtime/park.rs
201
245
tokio-rs/tokio:tokio/src/runtime/park.rs:3
impl Park for Parker { type Unpark = Unparker; type Error = (); fn unpark(&self) -> Unparker { Unparker { inner: self.inner.clone(), } } fn park(&mut self) -> Result<(), Self::Error> { self.inner.park(); Ok(()) } fn park_timeout(&mut self, durat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
8656b7b8eb6f3635ec40694eb71f14fb84211e05
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/runtime/park.rs
81
140
tokio-rs/tokio:tokio/src/runtime/park.rs:1
//! Parks the runtime. //! //! A combination of the various resource driver park handles. use crate::loom::sync::{Arc, Mutex, Condvar}; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::thread; use crate::park::{Park, Unpark}; use crate::runtime::time; use crate::util::TryLock; use std::sync::atomic::Order...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/park.rs
MIT
c0953d41a5cd2e0514b551771668139679332328
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c0953d41a5cd2e0514b551771668139679332328/tokio/src/runtime/park.rs
1
60