This class implements a task queue running in parallel. Basically this can be called a threads pool.
More...
#include <trantor/utils/ConcurrentTaskQueue.h>
|
| | ConcurrentTaskQueue (size_t threadNum, const std::string &name) |
| | Construct a new concurrent task queue instance.
|
| virtual void | runTaskInQueue (const std::function< void()> &task) |
| | Run a task in the queue.
|
| virtual void | runTaskInQueue (std::function< void()> &&task) |
| virtual std::string | getName () const |
| | Get the name of the queue.
|
| size_t | getTaskCount () |
| | Get the number of tasks to be executed in the queue.
|
|
void | stop () |
| | Stop all threads in the queue.
|
| void | syncTaskInQueue (const std::function< void()> &task) |
| | Run a task in the queue synchronously. This means that the task is executed before the method returns.
|
|
|
| NonCopyable (const NonCopyable &)=delete |
|
NonCopyable & | operator= (const NonCopyable &)=delete |
|
| NonCopyable (NonCopyable &&) noexcept(true)=default |
|
NonCopyable & | operator= (NonCopyable &&) noexcept(true)=default |
This class implements a task queue running in parallel. Basically this can be called a threads pool.
◆ ConcurrentTaskQueue()
| trantor::ConcurrentTaskQueue::ConcurrentTaskQueue |
( |
size_t | threadNum, |
|
|
const std::string & | name ) |
Construct a new concurrent task queue instance.
- Parameters
-
| threadNum | The number of threads in the queue. |
| name | The name of the queue. |
◆ getName()
| virtual std::string trantor::ConcurrentTaskQueue::getName |
( |
| ) |
const |
|
inlinevirtual |
◆ getTaskCount()
| size_t trantor::ConcurrentTaskQueue::getTaskCount |
( |
| ) |
|
Get the number of tasks to be executed in the queue.
- Returns
- size_t
◆ runTaskInQueue() [1/2]
| virtual void trantor::ConcurrentTaskQueue::runTaskInQueue |
( |
const std::function< void()> & | task | ) |
|
|
virtual |
◆ runTaskInQueue() [2/2]
| virtual void trantor::ConcurrentTaskQueue::runTaskInQueue |
( |
std::function< void()> && | task | ) |
|
|
virtual |
The documentation for this class was generated from the following file: