#task #yield #task-scheduler #now #run-time #pending #poll

yield-now

Wakes current task and returns Poll::Pending once

1 unstable release

0.1.0 Aug 11, 2024

#619 in Asynchronous

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–7MB
~52K SLoC