Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yield_now: add maybe_yield_now for cooperative scheduling
For cpu-only computations that do not use any Tokio resources, budgeting does not really kick in in order to yield and prevent other tasks from starvation. The new mechanism - maybe_yield_now, performs a budget check, consumes a unit of it, and yields only if the task exceeded the budget. That allows cpu-intenstive computations to define yield points that yield only conditionally, since unconditional yielding to runtime is a potentially heavy operation.
- Loading branch information