Class TaskScheduler
Defined in File task-scheduler.h
Class Documentation
-
class TaskScheduler
Public Types
Public Functions
-
virtual ~TaskScheduler()
-
virtual bool Submit(Task *task) = 0
Submit a job (task) to be run. This job may run on a different thread (there is no guarantee of running on separate threads, or on the calling thread — implementation- dependent).
- Parameters
task -- Instance of Task interface. Must be a heap object. TaskScheduler takes ownership of the Task instance upon submission and will delete the Task instance once the Task has completed execution (specifically, any time after the Task::Run method returns).
- Returns
True if task submission succeeded, false otherwise.
-
virtual void Shutdown() = 0
Stop the task scheduler. Will block until all busy threads are idle.
NOTE : For general use, prefer the static method
ShutdownInstance() over this instance method.
-
virtual void SetShutdownPolicy(ShutDownPolicy policy) = 0
Sets the behavior of TaskScheduler on shutdown.
- Parameters
policy --
Public Static Functions
-
static TaskScheduler *GetInstance()
Get singleton TaskScheduler instance, creating the instance if necessary.
-
static void ShutdownInstance()
Stop the singleton TaskScheduler instance if GetInstance() has been previously called, otherwise noop.
-
virtual ~TaskScheduler()