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. | |
Thread pool for worker threads.
| clan::WorkQueue::WorkQueue | ( | bool | serial_queue = false | ) |
Constructs a work queue.
| serial_queue | If true, executes items in the order they are queued, one at a time |
| clan::WorkQueue::~WorkQueue | ( | ) |
| 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 | ( | const std::function< void()> & | func | ) |
Queue some work to be executed on a worker thread.
| 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::work_completed | ( | const std::function< void()> & | func | ) |
Queue some work to be executed on the main WorkQueue thread.