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/enter.rs:2
// is executed. // // # Warning // // This is hidden for a reason. Do not use without fully understanding // executors. Misuing can easily cause your program to deadlock. #[cfg(all(feature = "rt-threaded", feature = "blocking"))] pub(crate) fn exit<F: FnOnce() -> R, R>(f: F) -> R { // Reset in case the closure pani...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
67c4cc03919a58076c139f0930f28c3c41dad1e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/67c4cc03919a58076c139f0930f28c3c41dad1e5/tokio/src/runtime/enter.rs
41
100
tokio-rs/tokio:tokio/src/runtime/enter.rs:3
use crate::park::{CachedParkThread, Park}; use std::pin::Pin; use std::task::Context; use std::task::Poll::Ready; let mut park = CachedParkThread::new(); let waker = park.get_unpark()?.into_waker(); let mut cx = Context::from_waker(&waker); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
67c4cc03919a58076c139f0930f28c3c41dad1e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/67c4cc03919a58076c139f0930f28c3c41dad1e5/tokio/src/runtime/enter.rs
81
140
tokio-rs/tokio:tokio/src/runtime/enter.rs:4
// `block_on` takes ownership of `f`. Once it is pinned here, the original `f` binding can // no longer be accessed, making the pinning safe. let mut f = unsafe { Pin::new_unchecked(&mut f) }; let when = Instant::now() + timeout; loop { if let Ready(v) = ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
67c4cc03919a58076c139f0930f28c3c41dad1e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/67c4cc03919a58076c139f0930f28c3c41dad1e5/tokio/src/runtime/enter.rs
121
156
tokio-rs/tokio:tokio/src/runtime/enter.rs:1
use std::cell::{Cell, RefCell}; use std::fmt; use std::marker::PhantomData; thread_local!(static ENTERED: Cell<bool> = Cell::new(false)); /// Represents an executor context. pub(crate) struct Enter { _p: PhantomData<RefCell<()>>, } /// Marks the current thread as being within the dynamic extent of an /// executo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
06a4d895ec8787386058a24b422dfa9a8514bc8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/runtime/enter.rs
1
60
tokio-rs/tokio:tokio/src/runtime/enter.rs:2
// is executed. // // # Warning // // This is hidden for a reason. Do not use without fully understanding // executors. Misuing can easily cause your program to deadlock. #[cfg(all(feature = "rt-threaded", feature = "blocking"))] pub(crate) fn exit<F: FnOnce() -> R, R>(f: F) -> R { // Reset in case the closure pani...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
06a4d895ec8787386058a24b422dfa9a8514bc8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/runtime/enter.rs
41
100
tokio-rs/tokio:tokio/src/runtime/enter.rs:3
/// Blocks the thread on the specified future, returning the value with /// which that future completes. pub(crate) fn block_on<F>(&mut self, mut f: F) -> Result<F::Output, ParkError> where F: std::future::Future, { use crate::park::{CachedParkThread, Park}; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
06a4d895ec8787386058a24b422dfa9a8514bc8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/runtime/enter.rs
81
140
tokio-rs/tokio:tokio/src/runtime/enter.rs:4
use std::time::Instant; let mut park = CachedParkThread::new(); let waker = park.get_unpark()?.into_waker(); let mut cx = Context::from_waker(&waker); // `block_on` takes ownership of `f`. Once it is pinned here, the original `f` binding can // no longer be ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
06a4d895ec8787386058a24b422dfa9a8514bc8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/runtime/enter.rs
121
162
tokio-rs/tokio:tokio/src/runtime/enter.rs:3
/// Blocks the thread on the specified future, returning the value with /// which that future completes. pub(crate) fn block_on<F>(&mut self, mut f: F) -> Result<F::Output, ParkError> where F: std::future::Future, { use crate::park::{CachedParkThread, Park}; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
9d6b99494b72e79b4afba5073a9ebef5bbbeca8a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9d6b99494b72e79b4afba5073a9ebef5bbbeca8a/tokio/src/runtime/enter.rs
81
140
tokio-rs/tokio:tokio/src/runtime/enter.rs:4
use std::time::Instant; let mut park = CachedParkThread::new(); let waker = park.get_unpark()?.into_waker(); let mut cx = Context::from_waker(&waker); // `block_on` takes ownership of `f`. Once it is pinned here, the original `f` binding can // no longer be ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
9d6b99494b72e79b4afba5073a9ebef5bbbeca8a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9d6b99494b72e79b4afba5073a9ebef5bbbeca8a/tokio/src/runtime/enter.rs
121
162
tokio-rs/tokio:tokio/src/runtime/enter.rs:2
// is executed. // // # Warning // // This is hidden for a reason. Do not use without fully understanding // executors. Misuing can easily cause your program to deadlock. #[cfg(all(feature = "rt-threaded", feature = "blocking"))] pub(crate) fn exit<F: FnOnce() -> R, R>(f: F) -> R { // Reset in case the closure pani...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
dcfa895b512e3ed522b81b18baf3e33fd78a600c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dcfa895b512e3ed522b81b18baf3e33fd78a600c/tokio/src/runtime/enter.rs
41
100
tokio-rs/tokio:tokio/src/runtime/enter.rs:3
/// which that future completes. pub(crate) fn block_on<F>(&mut self, mut f: F) -> Result<F::Output, ParkError> where F: std::future::Future, { use crate::park::{CachedParkThread, Park}; use std::pin::Pin; use std::task::Context; use st...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
dcfa895b512e3ed522b81b18baf3e33fd78a600c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dcfa895b512e3ed522b81b18baf3e33fd78a600c/tokio/src/runtime/enter.rs
81
123
tokio-rs/tokio:tokio/src/runtime/enter.rs:2
// is executed. // // # Warning // // This is hidden for a reason. Do not use without fully understanding // executors. Misuing can easily cause your program to deadlock. #[cfg(all(feature = "rt-threaded", feature = "blocking"))] pub(crate) fn exit<F: FnOnce() -> R, R>(f: F) -> R { // Reset in case the closure pani...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
adc5186ebd1290c2f144e153a87e147d257f8b0f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/adc5186ebd1290c2f144e153a87e147d257f8b0f/tokio/src/runtime/enter.rs
41
100
tokio-rs/tokio:tokio/src/runtime/enter.rs:2
// is executed. // // # Warning // // This is hidden for a reason. Do not use without fully understanding // executors. Misuing can easily cause your program to deadlock. #[cfg(all(feature = "rt-threaded", feature = "blocking"))] pub(crate) fn exit<F: FnOnce() -> R, R>(f: F) -> R { // Reset in case the closure pani...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
7b53b7b659fe1feeb30e768cad8fdadf9531beb6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b53b7b659fe1feeb30e768cad8fdadf9531beb6/tokio/src/runtime/enter.rs
41
100
tokio-rs/tokio:tokio/src/runtime/enter.rs:3
where F: std::future::Future, { use crate::park::{CachedParkThread, Park}; use std::pin::Pin; use std::task::Context; use std::task::Poll::Ready; let mut park = CachedParkThread::new(); let waker = park.unpark().into_waker(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
7b53b7b659fe1feeb30e768cad8fdadf9531beb6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b53b7b659fe1feeb30e768cad8fdadf9531beb6/tokio/src/runtime/enter.rs
81
120
tokio-rs/tokio:tokio/src/runtime/enter.rs:1
use std::cell::{Cell, RefCell}; use std::fmt; use std::marker::PhantomData; thread_local!(static ENTERED: Cell<bool> = Cell::new(false)); /// Represents an executor context. /// /// For more details, see [`enter` documentation](fn.enter.html) pub(crate) struct Enter { _p: PhantomData<RefCell<()>>, } /// Marks th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/enter.rs
1
60
tokio-rs/tokio:tokio/src/runtime/enter.rs:2
// Forces the current "entered" state to be cleared while the closure // is executed. // // # Warning // // This is hidden for a reason. Do not use without fully understanding // executors. Misuing can easily cause your program to deadlock. #[cfg(all(feature = "rt-threaded", feature = "blocking"))] pub(crate) fn exit<F...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/enter.rs
41
100
tokio-rs/tokio:tokio/src/runtime/enter.rs:3
/// which that future completes. pub(crate) fn block_on<F>(&mut self, mut f: F) -> F::Output where F: std::future::Future, { use crate::park::{CachedParkThread, Park}; use std::pin::Pin; use std::task::Context; use std::task::Poll::Read...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/enter.rs
81
122
tokio-rs/tokio:tokio/src/runtime/enter.rs:1
use std::cell::{Cell, RefCell}; use std::fmt; use std::marker::PhantomData; thread_local!(static ENTERED: Cell<bool> = Cell::new(false)); /// Represents an executor context. /// /// For more details, see [`enter` documentation](fn.enter.html) pub(crate) struct Enter { _p: PhantomData<RefCell<()>>, } /// Marks th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/runtime/enter.rs
1
60
tokio-rs/tokio:tokio/src/runtime/enter.rs:2
// Forces the current "entered" state to be cleared while the closure // is executed. // // # Warning // // This is hidden for a reason. Do not use without fully understanding // executors. Misuing can easily cause your program to deadlock. cfg_rt_threaded! { #[cfg(feature = "blocking")] pub(crate) fn exit<F: F...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/runtime/enter.rs
41
100
tokio-rs/tokio:tokio/src/runtime/enter.rs:3
/// which that future completes. pub(crate) fn block_on<F>(&mut self, mut f: F) -> F::Output where F: std::future::Future, { use crate::runtime::park::{CachedParkThread, Park}; use std::pin::Pin; use std::task::Context; use std::task::P...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/runtime/enter.rs
81
122
tokio-rs/tokio:tokio/src/runtime/enter.rs:1
use std::cell::{Cell, RefCell}; use std::fmt; #[cfg(feature = "rt-full")] use std::future::Future; use std::marker::PhantomData; thread_local!(static ENTERED: Cell<bool> = Cell::new(false)); /// Represents an executor context. /// /// For more details, see [`enter` documentation](fn.enter.html) pub(crate) struct Ente...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/enter.rs
1
60
tokio-rs/tokio:tokio/src/runtime/enter.rs:2
}) } // Forces the current "entered" state to be cleared while the closure // is executed. // // # Warning // // This is hidden for a reason. Do not use without fully understanding // executors. Misuing can easily cause your program to deadlock. #[cfg(feature = "rt-full")] pub(crate) fn exit<F: FnOnce() -> R, R>(f: F)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/enter.rs
41
100
tokio-rs/tokio:tokio/src/runtime/enter.rs:3
/// Blocks the thread on the specified future, returning the value with /// which that future completes. #[cfg(feature = "rt-full")] pub(crate) fn block_on<F: Future>(&mut self, mut f: F) -> F::Output { use crate::runtime::park::{CachedParkThread, Park}; use std::pin::Pin; use std::t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/enter.rs
81
120
tokio-rs/tokio:tokio/src/runtime/enter.rs:1
use std::cell::{Cell, RefCell}; use std::fmt; use std::future::Future; use std::marker::PhantomData; thread_local!(static ENTERED: Cell<bool> = Cell::new(false)); /// Represents an executor context. /// /// For more details, see [`enter` documentation](fn.enter.html) pub(crate) struct Enter { _p: PhantomData<RefC...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2/tokio/src/runtime/enter.rs
1
60
tokio-rs/tokio:tokio/src/runtime/enter.rs:2
} // Forces the current "entered" state to be cleared while the closure // is executed. // // # Warning // // This is hidden for a reason. Do not use without fully understanding // executors. Misuing can easily cause your program to deadlock. #[cfg(feature = "rt-full")] pub(crate) fn exit<F: FnOnce() -> R, R>(f: F) ->...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2/tokio/src/runtime/enter.rs
41
100
tokio-rs/tokio:tokio/src/runtime/enter.rs:3
/// which that future completes. pub(crate) fn block_on<F: Future>(&mut self, mut f: F) -> F::Output { use crate::runtime::park::{CachedParkThread, Park}; use std::pin::Pin; use std::task::Context; use std::task::Poll::Ready; let mut park = CachedParkThread::new(); l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/enter.rs
MIT
1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a7f6fb201c04e8bb02c6e59ddaabadceb8413c2/tokio/src/runtime/enter.rs
81
118
tokio-rs/tokio:tokio/src/runtime/global.rs:1
use crate::runtime::basic_scheduler; use crate::task::JoinHandle; use std::cell::Cell; use std::future::Future; #[derive(Clone, Copy)] enum State { // default executor not defined Empty, // Basic scheduler (runs on the current-thread) Basic(*const basic_scheduler::SchedulerPriv), // default exec...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
a2cfc877a7f45eb0e1ae8d2775e22ee91da725ec
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a2cfc877a7f45eb0e1ae8d2775e22ee91da725ec/tokio/src/runtime/global.rs
1
60
tokio-rs/tokio:tokio/src/runtime/global.rs:2
// Safety: The `BasicScheduler` value set the thread-local (same // thread). unsafe { basic_scheduler.spawn(future) } } State::Empty => { // Explicit drop of `future` silences the warning that `future` is // not used when neither rt-* feature flags are ena...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
a2cfc877a7f45eb0e1ae8d2775e22ee91da725ec
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a2cfc877a7f45eb0e1ae8d2775e22ee91da725ec/tokio/src/runtime/global.rs
41
100
tokio-rs/tokio:tokio/src/runtime/global.rs:3
F: FnOnce() -> R, { EXECUTOR.with(|cell| { let was = cell.replace(State::Empty); // Ensure that the executor is removed from the thread-local context // when leaving the scope. This handles cases that involve panicking. struct Reset<'a>(&'a Cell<State>, State); impl Drop fo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
a2cfc877a7f45eb0e1ae8d2775e22ee91da725ec
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a2cfc877a7f45eb0e1ae8d2775e22ee91da725ec/tokio/src/runtime/global.rs
81
102
tokio-rs/tokio:tokio/src/runtime/global.rs:2
// Safety: The `BasicScheduler` value set the thread-local (same // thread). unsafe { basic_scheduler.spawn(future) } } State::Empty => { // Explicit drop of `future` silences the warning that `future` is // not used when neither rt-* feature flags are ena...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
2cd1d74092226250e959b52e3271ccd358b54964
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2cd1d74092226250e959b52e3271ccd358b54964/tokio/src/runtime/global.rs
41
100
tokio-rs/tokio:tokio/src/runtime/global.rs:3
{ with_state(State::ThreadPool(thread_pool as *const _), f) } } fn with_state<F, R>(state: State, f: F) -> R where F: FnOnce() -> R, { EXECUTOR.with(|cell| { let was = cell.replace(State::Empty); // Ensure that the executor is removed from the thread-local context // when l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
2cd1d74092226250e959b52e3271ccd358b54964
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2cd1d74092226250e959b52e3271ccd358b54964/tokio/src/runtime/global.rs
81
109
tokio-rs/tokio:tokio/src/runtime/global.rs:1
use crate::runtime::basic_scheduler; use crate::task::JoinHandle; use std::cell::Cell; use std::future::Future; #[derive(Clone, Copy)] enum State { // default executor not defined Empty, // Basic scheduler (runs on the current-thread) Basic(*const basic_scheduler::SchedulerPriv), // default exec...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/runtime/global.rs
1
60
tokio-rs/tokio:tokio/src/runtime/global.rs:2
// Safety: The `BasicScheduler` value set the thread-local (same // thread). unsafe { basic_scheduler.spawn(future) } } State::Empty => { // Explicit drop of `future` silences the warning that `future` is // not used when neither rt-* feature flags are ena...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
0d38936b35779b604770120da2e98560bbb6241f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/runtime/global.rs
41
100
tokio-rs/tokio:tokio/src/runtime/global.rs:1
use crate::runtime::basic_scheduler; use crate::task::JoinHandle; #[cfg(feature = "rt-full")] use crate::runtime::thread_pool; use std::cell::Cell; use std::future::Future; #[derive(Clone, Copy)] enum State { // default executor not defined Empty, // Basic scheduler (runs on the current-thread) Basi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/runtime/global.rs
1
60
tokio-rs/tokio:tokio/src/runtime/global.rs:2
} State::Basic(basic_scheduler_ptr) => { let basic_scheduler = unsafe { &*basic_scheduler_ptr }; // Safety: The `BasicScheduler` value set the thread-local (same // thread). unsafe { basic_scheduler.spawn(future) } } State::Empty => { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/runtime/global.rs
41
100
tokio-rs/tokio:tokio/src/runtime/global.rs:3
F: FnOnce() -> R, { with_state(State::ThreadPool(thread_pool as *const _), f) } fn with_state<F, R>(state: State, f: F) -> R where F: FnOnce() -> R, { EXECUTOR.with(|cell| { let was = cell.replace(State::Empty); // Ensure that the executor is removed from the thread-local context /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/runtime/global.rs
81
109
tokio-rs/tokio:tokio/src/runtime/global.rs:1
use crate::runtime::basic_scheduler; #[cfg(feature = "rt-full")] use crate::runtime::thread_pool; use std::cell::Cell; use std::future::Future; #[derive(Clone, Copy)] enum State { // default executor not defined Empty, // Basic scheduler (runs on the current-thread) Basic(*const basic_scheduler::Sch...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
3f0eabe7798de624f5ee9c7562803bfb97e6088f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/src/runtime/global.rs
1
60
tokio-rs/tokio:tokio/src/runtime/global.rs:2
/// that processes each received connection. /// /// ``` /// use tokio::net::TcpListener; /// /// # async fn process<T>(_t: T) {} /// # async fn dox() -> Result<(), Box<dyn std::error::Error>> { /// let mut listener = TcpListener::bind("127.0.0.1:8080").await?; /// /// loop { /// let (socket, _) = listener.accept()...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
3f0eabe7798de624f5ee9c7562803bfb97e6088f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/src/runtime/global.rs
41
100
tokio-rs/tokio:tokio/src/runtime/global.rs:3
let basic_scheduler = unsafe { &*basic_scheduler_ptr }; // Safety: The `BasicScheduler` value set the thread-local (same // thread). unsafe { basic_scheduler.spawn_background(future); } } State::Empty => { // Explicit drop of `...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
3f0eabe7798de624f5ee9c7562803bfb97e6088f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/src/runtime/global.rs
81
140
tokio-rs/tokio:tokio/src/runtime/global.rs:1
use crate::runtime::current_thread; #[cfg(feature = "rt-full")] use crate::runtime::thread_pool; use std::cell::Cell; use std::future::Future; #[derive(Clone, Copy)] enum State { // default executor not defined Empty, // Current-thread executor CurrentThread(*const current_thread::Scheduler), /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/global.rs
1
60
tokio-rs/tokio:tokio/src/runtime/global.rs:2
/// that processes each received connection. /// /// ``` /// use tokio::net::TcpListener; /// /// # async fn process<T>(_t: T) {} /// # async fn dox() -> Result<(), Box<dyn std::error::Error>> { /// let mut listener = TcpListener::bind("127.0.0.1:8080").await?; /// /// loop { /// let (socket, _) = listener.accept()...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/global.rs
41
100
tokio-rs/tokio:tokio/src/runtime/global.rs:3
let current_thread = unsafe { &*current_thread_ptr }; // Safety: The `CurrentThread` value set the thread-local (same // thread). unsafe { current_thread.spawn_background(future); } } State::Empty => { // Explicit drop of `futu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/global.rs
81
140
tokio-rs/tokio:tokio/src/runtime/global.rs:4
} fn with_state<F, R>(state: State, f: F) -> R where F: FnOnce() -> R, { EXECUTOR.with(|cell| { let was = cell.replace(State::Empty); // Ensure that the executor is removed from the thread-local context // when leaving the scope. This handles cases that involve panicking. struc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/global.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/global.rs
121
146
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime; use crate::runtime::{context, scheduler, RuntimeFlavor, RuntimeMetrics}; /// Handle to the runtime. /// /// The handle is internally reference-counted and can be freely cloned. A handle can be /// obtained using the [`Runtime::handle`] method. /// /// [`Runtime::handle`]: crate::runtime::Runtime::h...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
{ let fut_size = mem::size_of::<F>(); if fut_size > BOX_FUTURE_THRESHOLD { self.spawn_named(Box::pin(future), SpawnMeta::new_unnamed(fut_size)) } else { self.spawn_named(future, SpawnMeta::new_unnamed(fut_size)) } } /// Runs the provided function on an ex...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
/// task::block_in_place(move || { /// Handle::current().block_on(async move { /// // do something async /// }); /// }); /// # } /// # } /// ``` /// /// [`JoinError`]: struct@crate::task::JoinError /// [`JoinHandle`]: struct@crate::task::JoinHandle /// [`Runti...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
#[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "block_on", _meta, super::task::Id::next().as_u64()); // Enter the runtime context. This sets the current driver handles and // prevents blocking an existing runtime. context::ente...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
future: F, meta: SpawnMeta<'_>, ) -> JoinHandle<F::Output> where F: Future + 'static, F::Output: 'static, { let id = crate::runtime::task::Id::next(); #[cfg(all( tokio_unstable, feature = "taskdump", feature = "rt", targ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:12
/// async fn main() { /// assert_eq!(RuntimeFlavor::MultiThread, Handle::current().runtime_flavor()); /// } /// # } /// ``` pub fn runtime_flavor(&self) -> RuntimeFlavor { match self.inner { scheduler::Handle::CurrentThread(_) => RuntimeFlavor::CurrentThread, #[cfg(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/handle.rs
441
500
tokio-rs/tokio:tokio/src/runtime/handle.rs:13
/// ``` /// use tokio::runtime::Handle; /// /// #[tokio::main(flavor = "current_thread", name = "my-runtime")] /// async fn main() { /// println!("Current runtime name: {}", Handle::current().name().unwrap()); /// } /// ``` /// pub fn name(&self) -> Option<&str> { match &se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/handle.rs
481
540
tokio-rs/tokio:tokio/src/runtime/handle.rs:16
/// /// ## Current Thread Runtime Requirements /// /// On the `current_thread` runtime, task dumps may only be requested /// from *within* the context of the runtime being dumped. Do not, for /// example, await `Handle::dump()` on a different runtime. /// /// # Li...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/handle.rs
601
660
tokio-rs/tokio:tokio/src/runtime/handle.rs:17
handle.dump().await }).await }, } } /// Produces `true` if the current task is being traced for a dump; /// otherwise false. This function is only public for integration /// testing purposes. Do not rely on it. #[doc(hidden)] ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/handle.rs
641
700
tokio-rs/tokio:tokio/src/runtime/handle.rs:18
impl TryCurrentError { pub(crate) fn new_no_context() -> Self { Self { kind: TryCurrentErrorKind::NoContext, } } pub(crate) fn new_thread_local_destroyed() -> Self { Self { kind: TryCurrentErrorKind::ThreadLocalDestroyed, } } /// Returns true...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/handle.rs
681
732
tokio-rs/tokio:tokio/src/runtime/handle.rs:19
impl fmt::Display for TryCurrentError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use TryCurrentErrorKind as E; match self.kind { E::NoContext => f.write_str(CONTEXT_MISSING_ERROR), E::ThreadLocalDestroyed => f.write_str(THREAD_LOCAL_DESTROYED_ERROR), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/handle.rs
721
732
tokio-rs/tokio:tokio/src/runtime/handle.rs:12
/// async fn main() { /// assert_eq!(RuntimeFlavor::MultiThread, Handle::current().runtime_flavor()); /// } /// # } /// ``` pub fn runtime_flavor(&self) -> RuntimeFlavor { match self.inner { scheduler::Handle::CurrentThread(_) => RuntimeFlavor::CurrentThread, #[cfg(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
25e7f2641ef2555d688c267059431a2802805f1d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/25e7f2641ef2555d688c267059431a2802805f1d/tokio/src/runtime/handle.rs
441
500
tokio-rs/tokio:tokio/src/runtime/handle.rs:16
/// /// ## Non-Termination When Workers Are Blocked /// /// The future produced by `Handle::dump` may never produce `Ready` if /// another runtime worker is blocked for more than 250ms. This may /// occur if a dump is requested during shutdown, or if another runtime /// w...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
25e7f2641ef2555d688c267059431a2802805f1d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/25e7f2641ef2555d688c267059431a2802805f1d/tokio/src/runtime/handle.rs
601
660
tokio-rs/tokio:tokio/src/runtime/handle.rs:17
{ let (tx, rx) = crate::sync::oneshot::channel(); crate::loom::thread::spawn(|| { let rt = crate::runtime::Builder::new_current_thread().build().unwrap(); rt.block_on(async { let _ = tx.send(f.await); }); }); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
25e7f2641ef2555d688c267059431a2802805f1d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/25e7f2641ef2555d688c267059431a2802805f1d/tokio/src/runtime/handle.rs
641
700
tokio-rs/tokio:tokio/src/runtime/handle.rs:18
/// other thread-locals. pub fn is_thread_local_destroyed(&self) -> bool { matches!(self.kind, TryCurrentErrorKind::ThreadLocalDestroyed) } } enum TryCurrentErrorKind { NoContext, ThreadLocalDestroyed, } impl fmt::Debug for TryCurrentErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) ->...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
25e7f2641ef2555d688c267059431a2802805f1d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/25e7f2641ef2555d688c267059431a2802805f1d/tokio/src/runtime/handle.rs
681
711
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
let fut_size = mem::size_of::<F>(); if fut_size > BOX_FUTURE_THRESHOLD { self.spawn_named(Box::pin(future), SpawnMeta::new_unnamed(fut_size)) } else { self.spawn_named(future, SpawnMeta::new_unnamed(fut_size)) } } /// Runs the provided function on an executor ded...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
/// Handle::current().block_on(async move { /// // do something async /// }); /// }); /// # } /// # } /// ``` /// /// [`JoinError`]: struct@crate::task::JoinError /// [`JoinHandle`]: struct@crate::task::JoinHandle /// [`Runtime::block_on`]: fn@crate::runtime::Runt...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
meta: SpawnMeta<'_>, ) -> JoinHandle<F::Output> where F: Future + 'static, F::Output: 'static, { let id = crate::runtime::task::Id::next(); #[cfg(all( tokio_unstable, feature = "taskdump", feature = "rt", target_os = "linux", ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:12
/// assert_eq!(RuntimeFlavor::MultiThread, Handle::current().runtime_flavor()); /// } /// # } /// ``` pub fn runtime_flavor(&self) -> RuntimeFlavor { match self.inner { scheduler::Handle::CurrentThread(_) => RuntimeFlavor::CurrentThread, #[cfg(feature = "rt-multi-thread...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5/tokio/src/runtime/handle.rs
441
500
tokio-rs/tokio:tokio/src/runtime/handle.rs:16
/// ## Non-Termination When Workers Are Blocked /// /// The future produced by `Handle::dump` may never produce `Ready` if /// another runtime worker is blocked for more than 250ms. This may /// occur if a dump is requested during shutdown, or if another runtime /// worker is inf...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5/tokio/src/runtime/handle.rs
601
660
tokio-rs/tokio:tokio/src/runtime/handle.rs:17
let (tx, rx) = crate::sync::oneshot::channel(); crate::loom::thread::spawn(|| { let rt = crate::runtime::Builder::new_current_thread().build().unwrap(); rt.block_on(async { let _ = tx.send(f.await); }); }); rx.await....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5/tokio/src/runtime/handle.rs
641
700
tokio-rs/tokio:tokio/src/runtime/handle.rs:18
pub fn is_thread_local_destroyed(&self) -> bool { matches!(self.kind, TryCurrentErrorKind::ThreadLocalDestroyed) } } enum TryCurrentErrorKind { NoContext, ThreadLocalDestroyed, } impl fmt::Debug for TryCurrentErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0fa7755e97b2b4ba4630d21a6d5316f39aaa4ee5/tokio/src/runtime/handle.rs
681
710
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
#[cfg(tokio_unstable)] use crate::runtime; use crate::runtime::{context, scheduler, RuntimeFlavor, RuntimeMetrics}; /// Handle to the runtime. /// /// The handle is internally reference-counted and can be freely cloned. A handle can be /// obtained using the [`Runtime::handle`] method. /// /// [`Runtime::handle`]: cra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
future: F, meta: SpawnMeta<'_>, ) -> JoinHandle<F::Output> where F: Future + 'static, F::Output: 'static, { let id = crate::runtime::task::Id::next(); #[cfg(all( tokio_unstable, feature = "taskdump", feature = "rt", targ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:12
/// async fn main() { /// assert_eq!(RuntimeFlavor::MultiThread, Handle::current().runtime_flavor()); /// } /// # } /// ``` pub fn runtime_flavor(&self) -> RuntimeFlavor { match self.inner { scheduler::Handle::CurrentThread(_) => RuntimeFlavor::CurrentThread, #[cfg(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/handle.rs
441
500
tokio-rs/tokio:tokio/src/runtime/handle.rs:16
/// re-poll every task in a special tracing mode. Avoid requesting dumps /// often. /// /// ## Local Executors /// /// Tasks managed by local executors (e.g., `FuturesUnordered` and /// [`LocalSet`][crate::task::LocalSet]) may not appear in task dumps. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/handle.rs
601
660
tokio-rs/tokio:tokio/src/runtime/handle.rs:17
cfg_rt_multi_thread! { /// Spawn a new thread and asynchronously await on its result. async fn spawn_thread<F>(f: F) -> <F as Future>::Output where F: Future + Send + 'static, <F as Future>::Output: Send + 'static { let (tx, rx) = crate::sync::oneshot:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/handle.rs
641
700
tokio-rs/tokio:tokio/src/runtime/handle.rs:18
/// the Tokio context. pub fn is_missing_context(&self) -> bool { matches!(self.kind, TryCurrentErrorKind::NoContext) } /// Returns true if the call failed because the Tokio context thread-local /// had been destroyed. This can usually only happen if in the destructor of /// other thread-lo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/handle.rs
681
718
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
#[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "block_on", _meta, super::task::Id::next().as_u64()); // Enter the runtime context. This sets the current driver handles and // prevents blocking an existing runtime. context::ente...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d1f1499f630c34c1d319acdc2cc86d7a1008c4b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
F: Future + 'static, F::Output: 'static, { let id = crate::runtime::task::Id::next(); #[cfg(all( tokio_unstable, feature = "taskdump", feature = "rt", target_os = "linux", any(target_arch = "aarch64", target_arch = "x86", target_arc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d1f1499f630c34c1d319acdc2cc86d7a1008c4b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:12
/// ``` pub fn runtime_flavor(&self) -> RuntimeFlavor { match self.inner { scheduler::Handle::CurrentThread(_) => RuntimeFlavor::CurrentThread, #[cfg(feature = "rt-multi-thread")] scheduler::Handle::MultiThread(_) => RuntimeFlavor::MultiThread, } } cfg_un...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d1f1499f630c34c1d319acdc2cc86d7a1008c4b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/handle.rs
441
500
tokio-rs/tokio:tokio/src/runtime/handle.rs:16
/// /// Tasks managed by local executors (e.g., `FuturesUnordered` and /// [`LocalSet`][crate::task::LocalSet]) may not appear in task dumps. /// /// ## Non-Termination When Workers Are Blocked /// /// The future produced by `Handle::dump` may never produce `Ready` if ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d1f1499f630c34c1d319acdc2cc86d7a1008c4b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/handle.rs
601
660
tokio-rs/tokio:tokio/src/runtime/handle.rs:17
where F: Future + Send + 'static, <F as Future>::Output: Send + 'static { let (tx, rx) = crate::sync::oneshot::channel(); crate::loom::thread::spawn(|| { let rt = crate::runtime::Builder::new_current_thread().build().unwrap(); rt.bl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d1f1499f630c34c1d319acdc2cc86d7a1008c4b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/handle.rs
641
700
tokio-rs/tokio:tokio/src/runtime/handle.rs:18
/// Returns true if the call failed because the Tokio context thread-local /// had been destroyed. This can usually only happen if in the destructor of /// other thread-locals. pub fn is_thread_local_destroyed(&self) -> bool { matches!(self.kind, TryCurrentErrorKind::ThreadLocalDestroyed) } } e...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d1f1499f630c34c1d319acdc2cc86d7a1008c4b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/handle.rs
681
714
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
/// task::block_in_place(move || { /// Handle::current().block_on(async move { /// // do something async /// }); /// }); /// # } /// # } /// ``` /// /// [`JoinError`]: struct@crate::task::JoinError /// [`JoinHandle`]: struct@crate::task::JoinHandle /// [`Runti...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ad6f6189529b1067bd4628d1c62abf9a3a64281e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ad6f6189529b1067bd4628d1c62abf9a3a64281e/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
#[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "block_on", _meta, super::task::Id::next().as_u64()); // Enter the runtime context. This sets the current driver handles and // prevents blocking an existing runtime. context::ente...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ad6f6189529b1067bd4628d1c62abf9a3a64281e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ad6f6189529b1067bd4628d1c62abf9a3a64281e/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
F: Future + 'static, F::Output: 'static, { let id = crate::runtime::task::Id::next(); #[cfg(all( tokio_unstable, tokio_taskdump, feature = "rt", target_os = "linux", any(target_arch = "aarch64", target_arch = "x86", target_arch = "x...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ad6f6189529b1067bd4628d1c62abf9a3a64281e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ad6f6189529b1067bd4628d1c62abf9a3a64281e/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// /// // Execute the future, blocking the current thread until completion /// handle.block_on(async { /// println!("hello"); /// }); /// # } /// ``` /// /// Or using `Handle::current`: /// /// ``` /// # #[cfg(not(target_family = "wasm"))] /// # { /// use tokio::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
if fut_size > BOX_FUTURE_THRESHOLD { self.block_on_inner(Box::pin(future), SpawnMeta::new_unnamed(fut_size)) } else { self.block_on_inner(future, SpawnMeta::new_unnamed(fut_size)) } } #[track_caller] fn block_on_inner<F: Future>(&self, future: F, _meta: SpawnMeta<'_>...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
target_os = "linux", any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") ))] let future = super::task::trace::Trace::root(future); #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "task", meta, id.as_u64()); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
/// /// #[tokio::main(flavor = "current_thread")] /// async fn main() { /// assert_eq!(RuntimeFlavor::CurrentThread, Handle::current().runtime_flavor()); /// } /// ``` /// /// ``` /// # #[cfg(not(target_family = "wasm"))] /// # { /// use tokio::runtime::{Handle, RuntimeFlavor};...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:12
/// **Note**: This is an [unstable API][unstable]. The public API of this type /// may break in 1.x releases. See [the documentation on unstable /// features][unstable] for details. /// /// [unstable]: crate#unstable-features /// [`Id`]: struct@crate::runtime::Id pub fn i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/runtime/handle.rs
441
500
tokio-rs/tokio:tokio/src/runtime/handle.rs:15
/// ## Current Thread Runtime Requirements /// /// On the `current_thread` runtime, task dumps may only be requested /// from *within* the context of the runtime being dumped. Do not, for /// example, await `Handle::dump()` on a different runtime. /// /// # Limitations ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/runtime/handle.rs
561
620
tokio-rs/tokio:tokio/src/runtime/handle.rs:16
}).await }, } } /// Produces `true` if the current task is being traced for a dump; /// otherwise false. This function is only public for integration /// testing purposes. Do not rely on it. #[doc(hidden)] pub fn is_tracing() -> bool { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/runtime/handle.rs
601
660
tokio-rs/tokio:tokio/src/runtime/handle.rs:17
pub(crate) fn new_no_context() -> Self { Self { kind: TryCurrentErrorKind::NoContext, } } pub(crate) fn new_thread_local_destroyed() -> Self { Self { kind: TryCurrentErrorKind::ThreadLocalDestroyed, } } /// Returns true if the call failed because...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/runtime/handle.rs
641
691
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
#[cfg(tokio_unstable)] use crate::runtime; use crate::runtime::{context, scheduler, RuntimeFlavor, RuntimeMetrics}; /// Handle to the runtime. /// /// The handle is internally reference-counted and can be freely cloned. A handle can be /// obtained using the [`Runtime::handle`] method. /// /// [`Runtime::handle`]: cra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
a0d5b8ab308bbeaa8090d411550d6c887d699096
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// /// The provided future will start running in the background immediately /// when `spawn` is called, even if you don't await the returned /// `JoinHandle`. /// /// See [module level][mod] documentation for more details. /// /// [mod]: index.html /// /// # Examples /// ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
a0d5b8ab308bbeaa8090d411550d6c887d699096
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// std::thread::spawn(move || { /// // Using Handle::block_on to run async code in the new thread. /// handle.block_on(async { /// println!("hello"); /// }); /// }); /// } /// ``` /// /// [`JoinError`]: struct@crate::task::JoinError //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
a0d5b8ab308bbeaa8090d411550d6c887d699096
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
let future = crate::util::trace::task(future, "block_on", _meta, super::task::Id::next().as_u64()); // Enter the runtime context. This sets the current driver handles and // prevents blocking an existing runtime. context::enter_runtime(&self.inner, true, |blocking| { blo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
a0d5b8ab308bbeaa8090d411550d6c887d699096
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
{ let id = crate::runtime::task::Id::next(); #[cfg(all( tokio_unstable, tokio_taskdump, feature = "rt", target_os = "linux", any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") ))] let future = super::task:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
a0d5b8ab308bbeaa8090d411550d6c887d699096
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
scheduler::Handle::MultiThread(_) => RuntimeFlavor::MultiThread, } } cfg_unstable! { /// Returns the [`Id`] of the current `Runtime`. /// /// # Examples /// /// ``` /// use tokio::runtime::Handle; /// /// #[tokio::main(flavor = "current_th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
a0d5b8ab308bbeaa8090d411550d6c887d699096
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:15
/// /// The future produced by `Handle::dump` may never produce `Ready` if /// another runtime worker is blocked for more than 250ms. This may /// occur if a dump is requested during shutdown, or if another runtime /// worker is infinite looping or synchronously deadlocked. For these ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
a0d5b8ab308bbeaa8090d411550d6c887d699096
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/handle.rs
561
620
tokio-rs/tokio:tokio/src/runtime/handle.rs:16
crate::loom::thread::spawn(|| { let rt = crate::runtime::Builder::new_current_thread().build().unwrap(); rt.block_on(async { let _ = tx.send(f.await); }); }); rx.await.unwrap() } } } /// Error returned by `try_curre...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
a0d5b8ab308bbeaa8090d411550d6c887d699096
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/handle.rs
601
660
tokio-rs/tokio:tokio/src/runtime/handle.rs:17
matches!(self.kind, TryCurrentErrorKind::ThreadLocalDestroyed) } } enum TryCurrentErrorKind { NoContext, ThreadLocalDestroyed, } impl fmt::Debug for TryCurrentErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { TryCurrentErrorKind::NoContext => f.wri...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
a0d5b8ab308bbeaa8090d411550d6c887d699096
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/handle.rs
641
669
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// std::thread::spawn(move || { /// // Using Handle::block_on to run async code in the new thread. /// handle.block_on(async { /// println!("hello"); /// }); /// }); /// } /// ``` /// /// [`JoinError`]: struct@crate::task::JoinError //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
let future = crate::util::trace::task(future, "block_on", _meta, super::task::Id::next().as_u64()); // Enter the runtime context. This sets the current driver handles and // prevents blocking an existing runtime. context::enter_runtime(&self.inner, true, |blocking| { blo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
{ let id = crate::runtime::task::Id::next(); #[cfg(all( tokio_unstable, tokio_taskdump, feature = "rt", target_os = "linux", any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") ))] let future = super::task:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/handle.rs
361
420