mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
tokio: deduplicate spawn_blocking (#3017)
Move common code and tracing integration into Handle Fixes #2998 Closes #3004 Signed-off-by: Marc-Antoine Perennou <[email protected]>
This commit is contained in:
@@ -72,10 +72,7 @@ where
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
{
|
||||
let rt = context::current().expect("not currently running on the Tokio runtime.");
|
||||
|
||||
let (task, handle) = task::joinable(BlockingTask::new(func));
|
||||
let _ = rt.blocking_spawner.spawn(task, &rt);
|
||||
handle
|
||||
rt.spawn_blocking(func)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
||||
Reference in New Issue
Block a user