Scheme for automatically assigning tasks to threads
role Scheduler {
has &.uncaught_handler is rw
}
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.
Some operations for example on Proc::Async, Promise, Supply allow you to specify a scheduler explicitly; they generally expect those schedulers to follow the interface defined by Scheduler.
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(&code, Instant :$at, :$in, :$every, :$times = 1; :&catch --> 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:
One should call the cancel method on the returned Cancellation object to cancel the (possibly repeated) cueing of the code.
method loads()
This is a method stub, should be re-implemented when subclassing.