Thread pool for worker threads. More...

#include <work_queue.h>

Public Member Functions

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

Detailed Description

Thread pool for worker threads.

Constructor & Destructor Documentation

◆ WorkQueue()

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

◆ ~WorkQueue()

clan::WorkQueue::~WorkQueue ( )

Member Function Documentation

◆ get_items_queued()

int clan::WorkQueue::get_items_queued ( ) const

Returns the number of items currently queued.

◆ process_work_completed()

void clan::WorkQueue::process_work_completed ( )

Process work completed queue.

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

◆ queue() [1/2]

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

Queue some work to be executed on a worker thread.

◆ queue() [2/2]

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.

◆ work_completed()

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: