mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-02 00:00:11 +02:00
runtime: add tracing span for block_on futures (#4094)
This commit is contained in:
@@ -296,7 +296,11 @@ impl Handle {
|
|||||||
/// [`tokio::fs`]: crate::fs
|
/// [`tokio::fs`]: crate::fs
|
||||||
/// [`tokio::net`]: crate::net
|
/// [`tokio::net`]: crate::net
|
||||||
/// [`tokio::time`]: crate::time
|
/// [`tokio::time`]: crate::time
|
||||||
|
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||||
pub fn block_on<F: Future>(&self, future: F) -> F::Output {
|
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, ...
|
// Enter the **runtime** context. This configures spawning, the current I/O driver, ...
|
||||||
let _rt_enter = self.enter();
|
let _rt_enter = self.enter();
|
||||||
|
|
||||||
|
|||||||
@@ -450,7 +450,11 @@ cfg_rt! {
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [handle]: fn@Handle::block_on
|
/// [handle]: fn@Handle::block_on
|
||||||
|
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||||
pub fn block_on<F: Future>(&self, future: F) -> F::Output {
|
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();
|
let _enter = self.enter();
|
||||||
|
|
||||||
match &self.kind {
|
match &self.kind {
|
||||||
|
|||||||
Reference in New Issue
Block a user