Thread pool for worker threads. More...

#include <work_queue.h>

Public Member Functions

 WorkQueue (bool serial_queue=false)
 Constructs a work queue. More...
 
 ~WorkQueue ()
 
int get_items_queued () const
 Returns the number of items currently queued. More...
 
void process_work_completed ()
 Process work completed queue. More...
 
void queue (WorkItem *item)
 Queue some work to be executed on a worker thread. More...
 
void queue (const std::function< void()> &func)
 Queue some work to be executed on a worker thread. More...
 
void work_completed (const std::function< void()> &func)
 Queue some work to be executed on the main WorkQueue thread. More...
 

Detailed Description

Thread pool for worker threads.

Constructor & Destructor Documentation

clan::WorkQueue::WorkQueue ( bool  serial_queue = false)

Constructs a work queue.

Parameters
serial_queueIf true, executes items in the order they are queued, one at a time
clan::WorkQueue::~WorkQueue ( )

Member Function Documentation

int clan::WorkQueue::get_items_queued ( ) const

Returns the number of items currently queued.

void clan::WorkQueue::process_work_completed ( )

Process work completed queue.

Needs to be called on the main WorkQueue thread periodically to finish queued work

void clan::WorkQueue::queue ( WorkItem item)

Queue some work to be executed on a worker thread.

Transfers ownership of the item queued. WorkQueue will delete the item.

void clan::WorkQueue::queue ( const std::function< void()> &  func)

Queue some work to be executed on a worker thread.

void clan::WorkQueue::work_completed ( const std::function< void()> &  func)

Queue some work to be executed on the main WorkQueue thread.


The documentation for this class was generated from the following file: