Alexandria
2.18
Please provide a description of the project.
|
Go to the documentation of this file.
54 task_ptr = Euclid::make_unique<ThreadPool::Task>(
m_queue.get().front());
90 : m_worker_run_flags(thread_count)
91 , m_worker_sleeping_flags(thread_count)
92 , m_worker_done_flags(thread_count)
94 for (
unsigned int i = 0; i < thread_count; ++i) {
107 for (
auto& flag : worker_flags) {
140 bool queue_is_empty =
false;
143 queue_is_empty =
m_queue.empty();
145 if (!queue_is_empty) {
std::reference_wrapper< std::atomic< bool > > m_done_flag
size_t running() const
Return the number of running tasks.
ThreadPool(unsigned int thread_count=std::thread::hardware_concurrency(), unsigned int empty_queue_wait_time=50)
Constructs a new ThreadPool.
std::vector< std::atomic< bool > > m_worker_run_flags
std::vector< std::atomic< bool > > m_worker_done_flags
std::reference_wrapper< std::atomic< bool > > m_sleeping_flag
T current_exception(T... args)
std::reference_wrapper< std::deque< ThreadPool::Task > > m_queue
std::deque< Task > m_queue
std::vector< std::thread > m_workers
size_t queued() const
Return the number of queued tasks.
std::reference_wrapper< std::atomic< bool > > m_run_flag
bool checkForException(bool rethrow=false)
Checks if any task has thrown an exception and optionally rethrows it.
unsigned int m_empty_queue_wait_time
unsigned int m_empty_queue_wait_time
T emplace_back(T... args)
std::vector< std::atomic< bool > > m_worker_sleeping_flags
std::exception_ptr m_exception_ptr
void submit(Task task)
Submit a task to be executed.
T rethrow_exception(T... args)
std::reference_wrapper< std::exception_ptr > m_exception_ptr
std::reference_wrapper< std::mutex > m_queue_mutex