A mutlithreading interface with a number of jobs in mind.
More...
#include <ThreadableTaskset.hpp>
|
void | BeginThreadedOperation (void) finaloverride |
| Called at the start of a threading operation in a new thread by the internal thread manager. Will call DoTask in the order of 0-(FNumTasks - 1) provided an error does not occur in doing so. On termination the cancel flag will be cleared. More...
|
|
void | CancelThreadedOperation (void) noexceptfinaloverride |
| Called by the internal thread manager to request cancellation of a thread. May also be called by the unit. When called no further tasks will be run after the current one completes. More...
|
|
virtual bool | DoTask (const unsigned int ATask)=0 |
| Called by BeginThreadedOperation FNumTasks times with an incrementing ATask value. Each time it is called task number ATask should be run. More...
|
|
|
const unsigned int | FNumTasks |
| The total number of tasks to perform.
|
|
std::atomic_bool | FCancelFlag |
| The cancellation flag.
|
|
A mutlithreading interface with a number of jobs in mind.
Definition at line 7 of file ThreadableTaskset.hpp.
CYB::API::ThreadableTaskset::ThreadableTaskset |
( |
const unsigned int |
ANumTasks | ) |
|
|
protectednoexcept |
Construct a ThreadableTaskset.
- Parameters
-
ANumTasks | The number of tasks to run on this taskset |
- Thread Safety
- This function requires no thread safety
void CYB::API::ThreadableTaskset::BeginThreadedOperation |
( |
void |
| ) |
|
|
finaloverridevirtual |
Called at the start of a threading operation in a new thread by the internal thread manager. Will call DoTask in the order of 0-(FNumTasks - 1) provided an error does not occur in doing so. On termination the cancel flag will be cleared.
- Calling Thread
- This function will be called by the engine in what should be considered a new thread, however it may be running in the ThreadPool depending on the calling context
- Attention
- Throwing an exception to this function will cause all remaining tasks to not be run and have the exception propagate to the internal thread manager where they will be logged at the DEV level and then ignored
Implements CYB::API::Threadable.
void CYB::API::ThreadableTaskset::CancelThreadedOperation |
( |
void |
| ) |
|
|
finaloverridevirtualnoexcept |
Called by the internal thread manager to request cancellation of a thread. May also be called by the unit. When called no further tasks will be run after the current one completes.
- Calling Thread
- This function may be called by the engine in any thread at any time during the object's lifetime
Implements CYB::API::Threadable.
virtual bool CYB::API::ThreadableTaskset::DoTask |
( |
const unsigned int |
ATask | ) |
|
|
pure virtual |
Called by BeginThreadedOperation FNumTasks times with an incrementing ATask
value. Each time it is called task number ATask
should be run.
- Parameters
-
ATask | The task number to run |
- Returns
- true to continue task execution, false otherwise
- Calling Thread
- The function will in the thread that the object's BeginThreadedOperation runs on
The documentation for this class was generated from the following file: