C4 Engine
C4 Engine API Documentation

class Job

Defined in:  C4Threads.h
The Job class represents a single job that runs in one of the Thread Manager's worker threads.
Definition

class Job : public ListElement<Job>

Member Functions
Job::JobComplete Returns a boolean value indicating whether a job has finished executing.
Job::JobCancelled Returns a boolean value indicating whether a job has been cancelled.
Job::GetThreadIndex Returns the worker thread index for a job.
Constructor

Job(ExecuteCallback *execCallback, void *cookie = nullptr);

Parameters
execCallback The main execution function for the job.
cookie A pointer to user-defined data that is passed to the job's execution function.
Description
The Job class is used to encapsulate the execution function and data for a single job. Jobs are queued for execution by one of the Thread Manager's worker threads by calling the ThreadMgr::SubmitJob function.

The function specified by the execCallback parameter should have the following signature.

typedef void ExecuteCallback(Job *, void *);

The first parameter passed to the execution function is a pointer to the Job object itself, and the second parameter is the cookie parameter that was passed to the Job constructor.
Base Classes
ListElement<Job> Used internally by the Thread Manager.
See Also

BatchJob

ThreadMgr