pub async fn yield_throttled()Expand description
Yield the current thread, but never resume faster than a polling loop should.
For guest-initiated busy-waits (sched_yield, a zero-delay poll) whose
caller makes no progress until something else changes: such a loop must not
peg a single-threaded host at 100 %. On WebAssembly targets this sleeps
10 ms (the timer-backed yield yield_now used to be); elsewhere it is
yield_now, since the scheduler there already runs other tasks and idles
when none is ready.
Do not use it to slice work that is making progress, because the wait is
not cheap: use yield_now.