summaryrefslogtreecommitdiffstats
path: root/tokio/src/runtime/handle.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/src/runtime/handle.rs')
-rw-r--r--tokio/src/runtime/handle.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/tokio/src/runtime/handle.rs b/tokio/src/runtime/handle.rs
index b1e8d8f1..c9ffd5cd 100644
--- a/tokio/src/runtime/handle.rs
+++ b/tokio/src/runtime/handle.rs
@@ -39,13 +39,26 @@ impl Handle {
// context::enter(self.clone(), f)
// }
- /// Run the provided function on an executor dedicated to blocking operations.
+ /// Run the provided function on an executor dedicated to blocking
+ /// operations.
+ #[cfg_attr(tokio_track_caller, track_caller)]
pub(crate) fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
where
F: FnOnce() -> R + Send + 'static,
{
#[cfg(feature = "tracing")]
let func = {
+ #[cfg(tokio_track_caller)]
+ let location = std::panic::Location::caller();
+ #[cfg(tokio_track_caller)]
+ let span = tracing::trace_span!(
+ target: "tokio::task",
+ "task",
+ kind = %"blocking",
+ function = %std::any::type_name::<F>(),
+ spawn.location = %format_args!("{}:{}:{}", location.file(), location.line(), location.column()),
+ );
+ #[cfg(not(tokio_track_caller))]
let span = tracing::trace_span!(
target: "tokio::task",
"task",