CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ThreadableTaskset.hpp
Go to the documentation of this file.
1 #pragma once
3 namespace CYB {
4  namespace API {
5 
7  class ThreadableTaskset : public Threadable {
8  private:
9  const unsigned int FNumTasks;
10  std::atomic_bool FCancelFlag;
11  protected:
18  ThreadableTaskset(const unsigned int ANumTasks) noexcept;
19  public:
26  void BeginThreadedOperation(void) final override;
32  void CancelThreadedOperation(void) noexcept final override;
40  virtual bool DoTask(const unsigned int ATask) = 0;
41  };
42  };
43 };
44 
45 #include "ThreadableTaskset.inl"
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.
std::atomic_bool FCancelFlag
The cancellation flag.
const unsigned int FNumTasks
The total number of tasks to perform.
The basic multithreading interface.
Definition: Threadable.hpp:6
void CancelThreadedOperation(void) noexceptfinaloverride
Called by the internal thread manager to request cancellation of a thread. May also be called by the ...
void BeginThreadedOperation(void) finaloverride
Called at the start of a threading operation in a new thread by the internal thread manager...
ThreadableTaskset(const unsigned int ANumTasks) noexcept
Construct a ThreadableTaskset.
A mutlithreading interface with a number of jobs in mind.