Alexandria
2.18
Please provide a description of the project.
|
Go to the documentation of this file.
25 #ifndef _ALEXANDRIAKERNEL_THREADPOOL_H
26 #define _ALEXANDRIAKERNEL_THREADPOOL_H
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::deque< Task > m_queue
std::vector< std::thread > m_workers
T hardware_concurrency(T... args)
size_t queued() const
Return the number of queued tasks.
bool checkForException(bool rethrow=false)
Checks if any task has thrown an exception and optionally rethrows it.
unsigned int m_empty_queue_wait_time
Basic thread pool implementation.
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.