Class TimerQueue

The TimerQueue manage a job heap sorted by job starting time. The object has it own control thread and sleep until the next job need to be started, then execute the job, delete it when it is done, and then fall asleep again. For periodic task the job can use repost to be automatically reposted at the end of the current execution. The approximate resolution of the queue is 1ms and to assure accuracy it recomended to only post short lived job. If a long tast needs to be started at a specific time, the TimerQueue object can be used to post the job to the job farm at a specific time.

Public type

typedef MuralU64 JobTime;
JobTime is used for time description.
class TimerJob;
TimerQueue:TimerJob are the job managed by the TimerQueue object.

Constructor and destructor


Public methods

void post_job(TimerJobPtr new_job);
post_job adds a new_job to the job queue.
void cancel_job(TimerJobPtr old_job);
cancel_job marks old_job as being canceled. If the old_job did not start running it will be removed from the queue. Otherwise the call as no effect.
static JobTime now();
now returns the current system time in millisecond.

Protected Methods


Public fields


Protected fields