Skip to content

Commit 12fdc12

Browse files
committed
rename task::blocking to task::spawn_blocking
Signed-off-by: Yoshua Wuyts <[email protected]>
1 parent b4c1c63 commit 12fdc12

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/task/block_on.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use kv_log_macro::trace;
2121
///
2222
/// See also: [`task::blocking`].
2323
///
24-
/// [`task::blocking`]: fn.blocking.html
24+
/// [`task::spawn_blocking`]: fn.spawn_blocking.html
2525
///
2626
/// [spawning]: https://doc.rust-lang.org/std/thread/fn.spawn.html
2727
/// [joining]: https://doc.rust-lang.org/std/thread/struct.JoinHandle.html#method.join

src/task/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ cfg_if::cfg_if! {
6060
/// is useful to prevent long-running synchronous operations from blocking the main futures
6161
/// executor.
6262
///
63-
/// See also: [`task::block_on`].
63+
/// See also: [`task::block_on`], [`task::spawn`].
6464
///
6565
/// [`task::block_on`]: fn.block_on.html
66+
/// [`task::spawn`]: fn.spawn.html
6667
///
6768
/// # Examples
6869
///
@@ -73,7 +74,7 @@ cfg_if::cfg_if! {
7374
/// #
7475
/// use async_std::task;
7576
///
76-
/// task::blocking(|| {
77+
/// task::spawn_blocking(|| {
7778
/// println!("long-running task here");
7879
/// }).await;
7980
/// #
@@ -84,10 +85,10 @@ cfg_if::cfg_if! {
8485
#[cfg(any(feature = "unstable", feature = "docs"))]
8586
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
8687
#[inline]
87-
pub fn blocking<F, R>(f: F) -> task::JoinHandle<R>
88+
pub fn spawn_blocking<F, R>(f: F) -> task::JoinHandle<R>
8889
where
8990
F: FnOnce() -> R + Send + 'static,
9091
R: Send + 'static,
9192
{
92-
blocking::spawn_blocking(future)
93+
blocking::spawn(f)
9394
}

0 commit comments

Comments
 (0)