Skip to content

Commit

Permalink
blocking: #[track_caller] for spawn_blocking (#4616)
Browse files Browse the repository at this point in the history
Annotates spawn_blocking() with #[track_caller] in order to produce the
correct tracing span spawn locations that show the caller as the spawn
point.
  • Loading branch information
domodwyer committed Apr 13, 2022
1 parent 252b0fa commit 221bb94
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tokio/src/runtime/blocking/pool.rs
Expand Up @@ -104,6 +104,7 @@ const KEEP_ALIVE: Duration = Duration::from_secs(10);
/// Runs the provided function on an executor dedicated to blocking operations.
/// Tasks will be scheduled as non-mandatory, meaning they may not get executed
/// in case of runtime shutdown.
#[track_caller]
pub(crate) fn spawn_blocking<F, R>(func: F) -> JoinHandle<R>
where
F: FnOnce() -> R + Send + 'static,
Expand Down

0 comments on commit 221bb94

Please sign in to comment.