class BatchJob
Defined in:
The C4Threads.h
BatchJob
class represents a single job that can be part of a batch.
Definition
class BatchJob : public Job, public ListElement<BatchJob>
Constructor
BatchJob(ExecuteCallback *execCallback, void *cookie = nullptr, uint32 flags = 0);
BatchJob(ExecuteCallback *execCallback, FinalizeCallback *finalCallback, void *cookie = nullptr, uint32 flags = 0);
Parameters
execCallback |
The main execution function for the job. |
finalCallback |
The finalization function for the job. |
cookie |
A pointer to user-defined data that is passed to the job's execution function. |
flags |
The job flags. See below for possible values. |
Description
The BatchJob
class is used to encapsulate the execution function and data for a single job. Batch jobs are queued for execution by one of the Thread Manager's worker threads by calling the ThreadMgr::SubmitJob
function and specifying a Batch
object.The functions specified by the
execCallback
and finalCallback
parameters should have the following signatures.
typedef void ExecuteCallback(Job *, void *);
typedef void FinalizeCallback(Job *, void *);
Job
object itself, and the second parameter is the cookie
parameter that was passed to the Job
constructor.The
flags
parameter can be a combination (through logical OR) of the following constants.
kJobNonpersistent |
The job is nonpersistent. If this flag is set, then the job is automatically destroyed when its batch is finished. |
kJobNonpersistent
flag is specified, then the BatchJob
object is automatically destroyed by the ThreadMgr::FinishBatch
function after a batch has finished executing.
Base Classes
Job |
A batch job is a specialized type of job. |
ListElement<BatchJob> |
Used internally by the Thread Manager. |
See Also