Public Types | Private Types | List of all members
blaze::threadpool::TaskQueue Class Reference

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. More...

#include <TaskQueue.h>

Public Types

typedef Tasks::size_type SizeType
 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

typedef std::deque< TaskTasks
 FIFO container for tasks.
 

Private Attributes

Member variables
Tasks tasks_
 FIFO container for the contained tasks.
 

Detailed Description

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.

Constructor & Destructor Documentation

blaze::threadpool::TaskQueue::~TaskQueue ( )
inline

Destructor for the TaskQueue class.

The destructor destroys any remaining task in the task queue.

Member Function Documentation

void blaze::threadpool::TaskQueue::clear ( )
inline

Removing all tasks from the task queue.

Returns
void
bool blaze::threadpool::TaskQueue::isEmpty ( ) const
inline

Returns true if the task queue has no elements.

Returns
true if the task queue is empty, false if it is not.
TaskQueue::SizeType blaze::threadpool::TaskQueue::maxSize ( ) const
inline

Returns the maximum possible size of a task queue.

Returns
The maximum possible size.
Task blaze::threadpool::TaskQueue::pop ( )
inline

Returns the task from the front of the task queue.

Returns
The first task in the task queue.
void blaze::threadpool::TaskQueue::push ( Task  task)
inline

Adding a task to the end of the task queue.

Parameters
taskThe task to be added to the end of the task queue.
Returns
void

This function adds the given task to the end of the task queue. It runs in constant time.

TaskQueue::SizeType blaze::threadpool::TaskQueue::size ( ) const
inline

Returns the current size of the task queue.

Returns
The current size.

This function returns the number of the currently contained tasks.

void blaze::threadpool::TaskQueue::swap ( TaskQueue tq)
inlinenoexcept

Swapping the contents of two task queues.

Parameters
tqThe task queue to be swapped.
Returns
void
Exceptions
no-throwguarantee.

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