ReplicaNet and RNLobby
1
|
#include <JobManager.h>
Public Member Functions | |
JobManager () | |
virtual | ~JobManager () |
void | SetPoolSize (const size_t poolSize=PlatformInfo::GetNumberOfCores()) |
bool | Start (void) |
bool | Stop (void) |
bool | AddPoolJob (Job *job) |
int | CancelJobs (void *const job) |
![]() | |
ThreadClass () | |
virtual | ~ThreadClass () |
void | Sleep (int milliseconds) |
![]() | |
MutexClass () | |
virtual | ~MutexClass () |
void | Lock (void) |
void | UnLock (void) |
![]() | |
Thread () | |
virtual | ~Thread () |
void | Begin (ThreadClass *threaded_class) |
void | Terminate (void) |
bool | GetTerminated (void) |
bool | GetEverTerminated (void) |
bool | GetIsRunning (void) const |
void | SetPreferredProcessor (int processor=kReplicaNetPreferredProcessorOSChoice) |
int | GetPreferredProcessor (void) |
Additional Inherited Members | |
![]() | |
enum | { kNoOwnerThread = -1 } |
![]() | |
static int | CallThreadEntry (ThreadClass *thread_class) |
static int | GetCurrentProcessorNumber (void) |
static size_t | GetNumAllocated (void) |
static size_t | GetNumActive (void) |
![]() | |
void | DoQuitNow (const int returnCode) |
void | CheckQuit (void) |
![]() | |
static size_t | GetNumAllocated (void) |
This JobManager class handles pool of threads that queue and run jobs.
JobManager | ( | ) |
The ctor performs some basic initialisation
|
virtual |
The dtor makes sure the entire job queue is terminated.
bool AddPoolJob | ( | Job * | job | ) |
Queues a jobs to run. If PlatformInfo::IsThreaded() returns false then AddPoolJob() will immediately run the job and return. Once the Job finishes running then it is automatically deleted. Before Job::Run() finishes the user should call out to save important Job data, or communicate the results of a calculation.