diff options
author | Haibo Huang <hhb@google.com> | 2020-11-02 18:47:23 -0800 |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2020-11-02 18:47:23 -0800 |
commit | bdf61e668e0593f8bcd0d30c512e7d5dbd09e38e (patch) | |
tree | 8847c6faf37c650915f060a07b3a0594cbff4b95 /src/runtime/handle.rs | |
parent | 4e8243bbb2f7f2747e80aafd270af79afebd0f38 (diff) | |
download | tokio-bdf61e668e0593f8bcd0d30c512e7d5dbd09e38e.tar.gz |
Upgrade rust/crates/tokio to 0.3.3
Test: make
Change-Id: I8fdff1bab68b03bc1fe8179d07e79bd6ece31027
Diffstat (limited to 'src/runtime/handle.rs')
-rw-r--r-- | src/runtime/handle.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/runtime/handle.rs b/src/runtime/handle.rs index b1e8d8f..72b9c06 100644 --- a/src/runtime/handle.rs +++ b/src/runtime/handle.rs @@ -39,13 +39,27 @@ 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, + 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", |