trantor
Non-blocking I/O cross-platform TCP network library, using C++14
Loading...
Searching...
No Matches
trantor::SerialTaskQueue Class Reference

This class represents a task queue in which all tasks are executed one by one. More...

#include <trantor/utils/SerialTaskQueue.h>

Inheritance diagram for trantor::SerialTaskQueue:
Collaboration diagram for trantor::SerialTaskQueue:

Public Member Functions

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.
void waitAllTasksFinished ()
 Wait until all tasks in the queue are finished.
 SerialTaskQueue (const std::string &name)
 Construct a new serial task queue instance.
bool isRuningTask ()
 Check whether a task is running in the queue.
bool isRunningTask ()
 Check whether a task is running in the queue.
size_t getTaskCount ()
 Get the number of tasks in the queue.
void stop ()
 Stop the queue.
Public Member Functions inherited from trantor::TaskQueue
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.

Protected Attributes

std::string queueName_
EventLoopThread loopThread_
bool stop_ {false}

Additional Inherited Members

Protected Member Functions inherited from trantor::NonCopyable
 NonCopyable (const NonCopyable &)=delete
NonCopyable & operator= (const NonCopyable &)=delete
 NonCopyable (NonCopyable &&) noexcept(true)=default
NonCopyable & operator= (NonCopyable &&) noexcept(true)=default

Detailed Description

This class represents a task queue in which all tasks are executed one by one.

Constructor & Destructor Documentation

◆ SerialTaskQueue()

trantor::SerialTaskQueue::SerialTaskQueue ( const std::string & name)
explicit

Construct a new serial task queue instance.

Parameters
name

Member Function Documentation

◆ getName()

virtual std::string trantor::SerialTaskQueue::getName ( ) const
inlinevirtual

Get the name of the queue.

Returns
std::string

Reimplemented from trantor::TaskQueue.

◆ getTaskCount()

size_t trantor::SerialTaskQueue::getTaskCount ( )

Get the number of tasks in the queue.

Returns
size_t

◆ isRuningTask()

bool trantor::SerialTaskQueue::isRuningTask ( )
inline

Check whether a task is running in the queue.

Returns
true
false
Deprecated
Use isRunningTask instead

◆ isRunningTask()

bool trantor::SerialTaskQueue::isRunningTask ( )
inline

Check whether a task is running in the queue.

Returns
true
false

◆ runTaskInQueue() [1/2]

virtual void trantor::SerialTaskQueue::runTaskInQueue ( const std::function< void()> & task)
virtual

Run a task in the queue.

Parameters
task

Implements trantor::TaskQueue.

◆ runTaskInQueue() [2/2]

virtual void trantor::SerialTaskQueue::runTaskInQueue ( std::function< void()> && task)
virtual

Implements trantor::TaskQueue.


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