#pause #yield #task-scheduler #give #now #run-time #pending

yield-now

Wakes current task and returns Poll::Pending once

1 unstable release

0.1.0 Aug 11, 2024

#594 in Asynchronous

21 downloads per month

MIT license

5KB

yield-now

Wakes current task and returns Poll::Pending once

This function can be used when we want to give task scheduler time to pause before doing some long running task.

this function will use runtime yield_now depending on which feature is enabled

see tokio::task::yield_now for tokio

see async_std::task::yield_now for async-std

see futures_lite::future::yield_now for futures-lite

Examples

use yield_now::yield_now;

yield_now().await;

License: MIT


lib.rs:

Wakes current task and returns Poll::Pending once

This function can be used when we want to give task scheduler time to pause before doing some long running task.

Examples

use yield_now::yield_now;

yield_now().await;

Dependencies

~0–8MB
~53K SLoC