Scheme for automatically assigning tasks to threads
A scheduler is a piece of code that determines which resources to use to run which task, and when. This role contains code that will be the same for all kinds of schedulers.
method uncaught_handler() is rw
RW-Accessor for the handler that is caught for uncaught exceptions from the code that is being scheduled and run.
method cue(, Instant :, :, :, : = 1; : --> Cancellation)
Schedules a callable (
&code) for execution and returns an instantiated
Cancellation object to cancel the scheduling of the code for execution (which is especially important if you specify the
:every ( time ) named parameter). The adverbs control when and how the code is run:
$atcan be an Instant before which the code won't be run. Alternatively
$inis the number of seconds (possibly fractional) to wait before running the code. If
$atis in the past or
$inis negative, the delay is treated as zero. Implementations may equate to zero very small values (e.g. lower than 0.001s) of
$inor result of
$everyis specified, it is interpreted as the number of seconds (possibly fractional) to wait before re-executing the code. Implementations may treat too-small values as lowest resolution they support, possibly warning in such situations; e.g. treating
$timestells the scheduler how many times to run the code.
&catchis called with the Exception as its sole argument if
&codewill never be run; if
&codewill only be run once. If any of the three are
&codewill be run immediately. If any of the three are
NaN, an X::Scheduler::CueInNaNSeconds exception will be thrown. This only applies to releases 2019.05 and later.
One should call the
cancel method on the returned
Cancellation object to cancel the (possibly repeated) cueing of the code.
This is a method stub, should be re-implemented when subclassing.