Skip to content

Commit f3a737b

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

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/task/block_on.rs

+1-1
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

+5-4
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ pub(crate) mod blocking;
5555
/// is useful to prevent long-running synchronous operations from blocking the main futures
5656
/// executor.
5757
///
58-
/// See also: [`task::block_on`].
58+
/// See also: [`task::block_on`], [`task::spawn`].
5959
///
6060
/// [`task::block_on`]: fn.block_on.html
61+
/// [`task::spawn`]: fn.spawn.html
6162
///
6263
/// # Examples
6364
///
@@ -68,7 +69,7 @@ pub(crate) mod blocking;
6869
/// #
6970
/// use async_std::task;
7071
///
71-
/// task::blocking(|| {
72+
/// task::spawn_blocking(|| {
7273
/// println!("long-running task here");
7374
/// }).await;
7475
/// #
@@ -79,10 +80,10 @@ pub(crate) mod blocking;
7980
#[cfg(any(feature = "unstable", feature = "docs"))]
8081
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
8182
#[inline]
82-
pub fn blocking<F, R>(f: F) -> task::JoinHandle<R>
83+
pub fn spawn_blocking<F, R>(f: F) -> task::JoinHandle<R>
8384
where
8485
F: FnOnce() -> R + Send + 'static,
8586
R: Send + 'static,
8687
{
87-
blocking::spawn_blocking(future)
88+
blocking::spawn(f)
8889
}

0 commit comments

Comments
 (0)