mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
runtime: add tracing span for block_on futures (#4094)
This commit is contained in:
parent
7e51b44a20
commit
6ebd0575e4
@ -296,7 +296,11 @@ impl Handle {
|
||||
/// [`tokio::fs`]: crate::fs
|
||||
/// [`tokio::net`]: crate::net
|
||||
/// [`tokio::time`]: crate::time
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
pub fn block_on<F: Future>(&self, future: F) -> F::Output {
|
||||
#[cfg(all(tokio_unstable, feature = "tracing"))]
|
||||
let future = crate::util::trace::task(future, "block_on", None);
|
||||
|
||||
// Enter the **runtime** context. This configures spawning, the current I/O driver, ...
|
||||
let _rt_enter = self.enter();
|
||||
|
||||
|
@ -450,7 +450,11 @@ cfg_rt! {
|
||||
/// ```
|
||||
///
|
||||
/// [handle]: fn@Handle::block_on
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
pub fn block_on<F: Future>(&self, future: F) -> F::Output {
|
||||
#[cfg(all(tokio_unstable, feature = "tracing"))]
|
||||
let future = crate::util::trace::task(future, "block_on", None);
|
||||
|
||||
let _enter = self.enter();
|
||||
|
||||
match &self.kind {
|
||||
|
Loading…
x
Reference in New Issue
Block a user