diff options
Diffstat (limited to 'tokio/src/task')
-rw-r--r-- | tokio/src/task/spawn.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tokio/src/task/spawn.rs b/tokio/src/task/spawn.rs index 4d18ee23..c4589308 100644 --- a/tokio/src/task/spawn.rs +++ b/tokio/src/task/spawn.rs @@ -123,6 +123,8 @@ doc_rt_core! { T: Future + Send + 'static, T::Output: Send + 'static, { - runtime::spawn(task) + let spawn_handle = runtime::context::ThreadContext::spawn_handle() + .expect("must be called from the context of Tokio runtime configured with either `basic_scheduler` or `threaded_scheduler`"); + spawn_handle.spawn(task) } } |