TaskPoolScheduler

A simple thread-based scheduler that sleeps until the next task, and runs it using a task pool. Allows for adding and removing jobs only when not running.

Constructors

this
this(TaskPool taskPool, CurrentTimeProvider timeProvider)

Constructs a new threaded job scheduler.

this
this()

Constructs a new threaded job scheduler with a default task pool and time provider.

Members

Functions

addScheduledJob
void addScheduledJob(ScheduledJob job)

Adds a job to the scheduler. For this scheduler, jobs are added to the list in-order, such that the first job is the one whose next execution time is the closest.

getNextScheduledJobId
ulong getNextScheduledJobId()

Gets the next available id to assign to a scheduled job. This must be unique among all jobs that have been added to the scheduler but not yet removed.

getTimeProvider
CurrentTimeProvider getTimeProvider()
Undocumented in source. Be warned that the author may not have intended to support it.
jobCount
ulong jobCount()

Gets the number of jobs that this scheduler has.

removeAllScheduledJobs
void removeAllScheduledJobs()

Removes all jobs from the scheduler.

removeScheduledJob
bool removeScheduledJob(ScheduledJob job)

Removes a job from the scheduler.

start
void start()

Starts the scheduler. Once started, there is no guarantee that all scheduler implementations will allow adding new jobs while running.

stop
void stop(bool force)

Stops the scheduler.

Inherited Members

From MutableJobScheduler

removeScheduledJob
bool removeScheduledJob(ScheduledJob job)

Removes a job from the scheduler.

Meta