Function Reactor.shouldYield
Returns whether the fiber is already running for a long time.
bool shouldYield
(
uint tolerance = 1u
) nothrow @nogc @safe const;
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
.
Parameters
Name | Description |
---|---|
tolerance | 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. |