dpp::thread_pool
thread_pool.h
std::condition_variable std::condition_variable dpp::thread_pool::cv cv dpp::thread_pool::cv

Condition variable to notify for new tasks to run.

std::mutex std::mutex dpp::thread_pool::queue_mutex queue_mutex dpp::thread_pool::queue_mutex

Mutex for accessing the priority queue.

bool bool dpp::thread_pool::stop stop dpp::thread_pool::stop {false}

True if the thread pool is due to stop.

std::priority_queue< thread_pool_task, std::vector< thread_pool_task >, thread_pool_task_comparator > std::priority_queue<thread_pool_task, std::vector<thread_pool_task>, thread_pool_task_comparator> dpp::thread_pool::tasks tasks dpp::thread_pool::tasks

Priority queue of tasks to be executed.

std::vector< std::thread > std::vector<std::thread> dpp::thread_pool::threads threads dpp::thread_pool::threads

Threads that comprise the thread pool.

dpp::thread_pool::thread_pool
(class cluster *creator, size_t num_threads=std::thread::hardware_concurrency())
thread_pool
dpp::thread_pool::thread_pool
class cluster * creator
size_t num_threads std::thread::hardware_concurrency()

Create a new priority thread pool.

creator

creating cluster (for logging)

num_threads

number of threads in the pool

dpp::thread_pool::~thread_pool
()
~thread_pool
dpp::thread_pool::~thread_pool

Destroy the thread pool.

void void dpp::thread_pool::enqueue (thread_pool_task task) enqueue dpp::thread_pool::enqueue thread_pool_task task

Enqueue a new task to the thread pool.

task

task to enqueue

A thread pool contains 1 or more worker threads which accept thread_pool_task lambadas into a queue, which is processed in-order by whichever thread is free.

T
bool
dpp::thread_pool
threads
tasks
queue_mutex
cv
stop
dpp::thread_pool_task
priority
function
int
condition_variable
function< void()>
std::mutex
std::priority_queue< T >
elements
std::priority_queue< dpp::thread_pool_task, std::vector< dpp::thread_pool_task >, dpp::thread_pool_task_comparator >
elements
< dpp::thread_pool_task, std::vector< dpp::thread_pool_task >, dpp::thread_pool_task_comparator >
std::thread
std::vector< T >
elements
std::vector< std::thread >
elements
< std::thread >
- dpp::thread_pool
  cv
- dpp::thread_pool
  enqueue
- dpp::thread_pool
  queue_mutex
- dpp::thread_pool
  stop
- dpp::thread_pool
  tasks
- dpp::thread_pool
  thread_pool
- dpp::thread_pool
  threads
- dpp::thread_pool
  ~thread_pool