1 #ifndef AETHER_THREADPOOL_HPP 2 #define AETHER_THREADPOOL_HPP 4 #include <condition_variable> 42 struct WorkerMetadata {
43 std::condition_variable conditionVariable;
57 std::deque<std::pair<Job *, int>> jobs;
59 std::condition_variable workerConditionVariable;
60 std::vector<WorkerMetadata> workerMetadata;
61 std::vector<std::thread> workers;
73 void doWork(
size_t idx);
void operator=(const ThreadPool &)=delete
Prevent assigning.
void removeOrWaitForJob(int id)
Removes the requested job from the queue, or waits until the job is completed if already running...
Base namespace for all Aether related classes and functions.
static ThreadPool * getInstance()
Returns the instance of the ThreadPool. One is created if it does not already exist.
Basic Thread Pool implemented as a singleton.
Definition: ThreadPool.hpp:22
Importance
Enumeration of job importance levels.
Definition: ThreadPool.hpp:33
size_t maxConcurrentJobs()
Returns the maximum number of jobs that can be executed concurrently.
The Window is the root element, which initializes Aether and contains all of the screens/elements to ...
Definition: Window.hpp:27
int queueJob(Job *job, const Importance importance)
Adds a job to the queue. The job object is deleted once it is complete.
Abstract class representing a job for the ThreadPool. It is designed to be inherited to define the jo...
Definition: ThreadPool.Job.hpp:11