Alexandria
2.16
Please provide a description of the project.
|
Go to the documentation of this file.
52 task_ptr = make_unique<ThreadPool::Task>(
m_queue.get().front());
90 : m_worker_run_flags(thread_count), m_worker_sleeping_flags(thread_count),
92 for (
unsigned int i = 0; i < thread_count; ++i) {
105 for (
auto& flag : worker_flags) {
127 bool queue_is_empty =
false;
130 queue_is_empty =
m_queue.empty();
132 if (!queue_is_empty) {
std::reference_wrapper< std::atomic< bool > > m_done_flag
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::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
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