Job Queue class to handle a queue of unique jobs to be processed sequentially.
More...
|
| CJobQueue (bool lifo=false, unsigned int jobsAtOnce=1, CJob::PRIORITY priority=CJob::PRIORITY_LOW) |
| CJobQueue constructor. More...
|
|
| ~CJobQueue () override |
| CJobQueue destructor Cancels any in-process jobs, and destroys the job queue. More...
|
|
bool | AddJob (CJob *job) |
| Add a job to the queue On completion of the job, destruction of the job queue or in case the job could not be added successfully, the CJob object will be destroyed. More...
|
|
template<typename F > |
void | Submit (F &&f) |
| Add a function f to this job queue.
|
|
void | CancelJob (const CJob *job) |
| Cancel a job in the queue Cancels a job in the queue. Any job currently being processed may complete after this call has completed, but OnJobComplete will not be performed. If the job is only queued then it will be removed from the queue and deleted. More...
|
|
void | CancelJobs () |
| Cancel all jobs in the queue Removes all jobs from the queue. Any job currently being processed may complete after this call has completed, but OnJobComplete will not be performed. More...
|
|
bool | IsProcessing () const |
| Check whether the queue is processing a job.
|
|
void | OnJobComplete (unsigned int jobID, bool success, CJob *job) override |
| The callback used when a job completes. More...
|
|
void | OnJobAbort (unsigned int jobID, CJob *job) override |
| The callback used when a job will be aborted. More...
|
|
virtual | ~IJobCallback ()=default |
| Destructor for job call back objects. More...
|
|
virtual void | OnJobProgress (unsigned int jobID, unsigned int progress, unsigned int total, const CJob *job) |
| An optional callback function that a job may call while processing. More...
|
|
Job Queue class to handle a queue of unique jobs to be processed sequentially.
Holds a queue of jobs to be processed sequentially, either first in,first out or last in, first out. Jobs are unique, so queueing multiple copies of the same job (based on the CJob::operator==) will not add additional jobs.
Classes should subclass this class and override OnJobCallback should they require information from the job.
- See also
- CJob and IJobCallback