Asynchronous task interface. More...
#include <ThreadPool.h>
Public Member Functions | |
virtual ASYNC_TASK_STATUS DILIGENT_CALL_TYPE | Run (Uint32 ThreadId)=0 |
Run the asynchronous task. | |
virtual void DILIGENT_CALL_TYPE | Cancel ()=0 |
Cancel the task, if possible. | |
virtual void DILIGENT_CALL_TYPE | SetStatus (ASYNC_TASK_STATUS TaskStatus)=0 |
Sets the task status, see Diligent::ASYNC_TASK_STATUS. | |
virtual ASYNC_TASK_STATUS DILIGENT_CALL_TYPE | GetStatus () const =0 |
Gets the task status, see Diligent::ASYNC_TASK_STATUS. | |
virtual void DILIGENT_CALL_TYPE | SetPriority (float fPriority)=0 |
Sets the task priorirty. | |
virtual float DILIGENT_CALL_TYPE | GetPriority () const =0 |
Returns the task priorirty. | |
virtual bool DILIGENT_CALL_TYPE | IsFinished () const =0 |
Checks if the task is finished (i.e. cancelled or complete). | |
virtual void DILIGENT_CALL_TYPE | WaitForCompletion () const =0 |
Waits until the task is complete. | |
virtual void DILIGENT_CALL_TYPE | WaitUntilRunning () const =0 |
Waits until the tasks is running. | |
![]() | |
virtual void DILIGENT_CALL_TYPE | QueryInterface (const INTERFACE_ID &IID, IObject **ppInterface)=0 |
Queries the specific interface. | |
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE | AddRef ()=0 |
Increments the number of strong references by 1. | |
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE | Release ()=0 |
virtual IReferenceCounters *DILIGENT_CALL_TYPE | GetReferenceCounters () const =0 |
Asynchronous task interface.
|
pure virtual |
Cancel the task, if possible.
If the task is running, the task implementation should abort the task execution, if possible.
|
pure virtual |
Run the asynchronous task.
[in] | ThreadId | - Id of the thread that is running this task. |
Before starting the task, the thread pool sets its status to Diligent::ASYNC_TASK_STATUS_RUNNING.
The method must return one of the following values:
The thread pool will set the task status to the returned value after the Run() method completes. This way if the GetStatus() method returns any value other than Diligent::ASYNC_TASK_STATUS_RUNNING, it is guaranteed that the task is not executed by any thread.
|
pure virtual |
Waits until the task is complete.
|
pure virtual |
Waits until the tasks is running.
This method must not be called from the worker thread.