We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
task::spawn_blocking
1 parent a2744e3 commit 958d3a9Copy full SHA for 958d3a9
src/task/mod.rs
@@ -48,3 +48,17 @@ mod task_local;
48
mod worker;
49
50
pub(crate) mod blocking;
51
+
52
+/// Spawns a blocking task.
53
+///
54
+/// The task will be spawned onto a thread pool specifically dedicated to blocking tasks.
55
+#[cfg(any(feature = "unstable", feature = "docs"))]
56
+#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
57
+#[inline]
58
+pub fn spawn_blocking<F, R>(future: F) -> blocking::JoinHandle<R>
59
+where
60
+ F: crate::future::Future<Output = R> + Send + 'static,
61
+ R: Send + 'static,
62
+{
63
+ blocking::spawn(future)
64
+}
0 commit comments