Function tokio::runtime::coop::poll_proceed
source · pub(crate) fn poll_proceed(cx: &mut Context<'_>) -> Poll<RestoreOnPending>
Expand description
Returns Poll::Pending
if the current task has exceeded its budget and should yield.
When you call this method, the current budget is decremented. However, to ensure that
progress is made every time a task is polled, the budget is automatically restored to its
former value if the returned RestoreOnPending
is dropped. It is the caller’s
responsibility to call RestoreOnPending::made_progress
if it made progress, to ensure
that the budget empties appropriately.
Note that RestoreOnPending
restores the budget as it was before poll_proceed
.
Therefore, if the budget is further adjusted between when poll_proceed
returns and
RestRestoreOnPending
is dropped, those adjustments are erased unless the caller indicates
that progress was made.