A Scheduler can be used to schedule and reschedule functions to be evaluated at a specific time-point. The Scheduler's time needs to be advanced manually. In most cases you will probably want to use a Clock (e.g. TempoClock, SystemClock, AppClock) instead, in which the march of time is handled for you.
clock |
A clock, like SystemClock. |
drift |
If |
recursive |
Sets -recursive. |
Schedules the task immediately. Equivalent to sched(0, task)
.
Schedule the task at delta
seconds relative to the current time, as defined by the drift
argument of the constructor.
Regardless of what time a task is scheduled, it will only be awaken the next time -seconds is set.
Schedule the task at absolute time
in seconds.
Advance the current logical time by delta
seconds. Has same effect as setting -seconds.
The current logical time of the scheduler.
Setting a new time will wake up (evaluate) any tasks scheduled within that time; a task that returns a new time will be rescheduled accordingly.
Returns whether the scheduling queue is empty.
Clears the scheduling queue
The instance of PriorityQueue used internally as scheduling queue.
If waking up items results in new items being scheduled, but some of them are already expired (scheduled at current time or earlier), this variable determines whether those items will be awaken as well in the same call to -seconds.