[][src]Function async_std::task::yield_now

pub async fn yield_now()
This is supported on unstable only.

Cooperatively gives up a timeslice to the task scheduler.

Calling this function will move the currently executing future to the back of the execution queue, making room for other futures to execute. This is especially useful after running CPU-intensive operations inside a future.

See also task::spawn_blocking.

Examples

Basic usage:

use async_std::task;

task::yield_now().await;