![]() |
Blaze 3.9
|
Task queue for the thread pool. More...
#include <TaskQueue.h>
Public Types | |
using | SizeType = Tasks::size_type |
Size type of the task queue. | |
Public Member Functions | |
Constructor | |
TaskQueue () | |
Default constructor for TaskQueue. | |
Destructor | |
~TaskQueue () | |
Destructor for the TaskQueue class. More... | |
Get functions | |
SizeType | maxSize () const |
Returns the maximum possible size of a task queue. More... | |
SizeType | size () const |
Returns the current size of the task queue. More... | |
bool | isEmpty () const |
Returns true if the task queue has no elements. More... | |
Element functions | |
void | push (Task task) |
Adding a task to the end of the task queue. More... | |
Task | pop () |
Returns the task from the front of the task queue. More... | |
void | clear () |
Removing all tasks from the task queue. More... | |
Utility functions | |
void | swap (TaskQueue &tq) noexcept |
Swapping the contents of two task queues. More... | |
Private Types | |
using | Tasks = std::deque< Task > |
FIFO container for tasks. | |
Private Attributes | |
Member variables | |
Tasks | tasks_ |
FIFO container for the contained tasks. | |
Task queue for the thread pool.
The TaskQueue class represents the internal task container of a thread pool. It uses a FIFO (first in, first out) strategy to store and remove the assigned tasks.
|
inline |
Destructor for the TaskQueue class.
The destructor destroys any remaining task in the task queue.
|
inline |
Removing all tasks from the task queue.
|
inline |
Returns true if the task queue has no elements.
|
inline |
Returns the maximum possible size of a task queue.
|
inline |
Returns the task from the front of the task queue.
|
inline |
Adding a task to the end of the task queue.
task | The task to be added to the end of the task queue. |
This function adds the given task to the end of the task queue. It runs in constant time.
|
inline |
Returns the current size of the task queue.
This function returns the number of the currently contained tasks.
|
inlinenoexcept |
Swapping the contents of two task queues.
tq | The task queue to be swapped. |
no-throw | guarantee. |