Reactor.shouldYield

Returns whether the fiber is already running for a long time.

Fibers that run for too long prevent other fibers from operating properly. On the other hand, fibers that initiate a context switch needlessly load the system with overhead.

This function reports whether the fiber is already running more than the desired time.

The base time used is taken from OpenOptions.maxDesiredRunTime.

struct Reactor
const nothrow @safe @nogc
bool
shouldYield
(
uint tolerance = 1
)

Parameters

tolerance uint

A multiplier for the amount of acceptable run time. Specifying 4 here will give you 4 times as much time to run before a context switch is deemed necessary.

Meta