aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mod.rs
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-11-02 18:47:23 -0800
committerHaibo Huang <hhb@google.com>2020-11-02 18:47:23 -0800
commitbdf61e668e0593f8bcd0d30c512e7d5dbd09e38e (patch)
tree8847c6faf37c650915f060a07b3a0594cbff4b95 /src/runtime/mod.rs
parent4e8243bbb2f7f2747e80aafd270af79afebd0f38 (diff)
downloadtokio-bdf61e668e0593f8bcd0d30c512e7d5dbd09e38e.tar.gz
Upgrade rust/crates/tokio to 0.3.3
Test: make Change-Id: I8fdff1bab68b03bc1fe8179d07e79bd6ece31027
Diffstat (limited to 'src/runtime/mod.rs')
-rw-r--r--src/runtime/mod.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/runtime/mod.rs b/src/runtime/mod.rs
index be4aa38..f85344d 100644
--- a/src/runtime/mod.rs
+++ b/src/runtime/mod.rs
@@ -357,11 +357,14 @@ cfg_rt! {
/// });
/// # }
/// ```
+ #[cfg_attr(tokio_track_caller, track_caller)]
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
where
F: Future + Send + 'static,
F::Output: Send + 'static,
{
+ #[cfg(feature = "tracing")]
+ let future = crate::util::trace::task(future, "task");
match &self.kind {
#[cfg(feature = "rt-multi-thread")]
Kind::ThreadPool(exec) => exec.spawn(future),
@@ -385,9 +388,11 @@ cfg_rt! {
/// println!("now running on a worker thread");
/// });
/// # }
+ #[cfg_attr(tokio_track_caller, track_caller)]
pub fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
where
F: FnOnce() -> R + Send + 'static,
+ R: Send + 'static,
{
self.handle.spawn_blocking(func)
}
@@ -415,7 +420,7 @@ cfg_rt! {
///
/// # Panics
///
- /// This function panics if the provided future panics, or if not called within an
+ /// This function panics if the provided future panics, or if called within an
/// asynchronous execution context.
///
/// # Examples