Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Public Member Functions | List of all members
toolbox::util::TaskQueue< TaskT > Class Template Referencefinal

A vector-based task queue for use in multi-threaded, producer-consumer components. More...

#include <toolbox/util/TaskQueue.hpp>

Public Member Functions

 TaskQueue ()=default
 
 ~TaskQueue ()=default
 
 TaskQueue (const TaskQueue &)=delete
 
TaskQueueoperator= (const TaskQueue &)=delete
 
 TaskQueue (TaskQueue &&)=delete
 
TaskQueueoperator= (TaskQueue &&)=delete
 
template<typename FnT >
bool run (FnT fn)
 
void stop ()
 Interrupt and exit any inprogress call to run().
 
void clear () noexcept
 Clear task queue.
 
bool push (TaskT &&task) noexcept
 Push task onto the task queue.
 

Detailed Description

template<typename TaskT>
class toolbox::util::TaskQueue< TaskT >

A vector-based task queue for use in multi-threaded, producer-consumer components.

Definition at line 28 of file TaskQueue.hpp.

Constructor & Destructor Documentation

◆ TaskQueue() [1/3]

template<typename TaskT >
toolbox::util::TaskQueue< TaskT >::TaskQueue ( )
default

◆ ~TaskQueue()

template<typename TaskT >
toolbox::util::TaskQueue< TaskT >::~TaskQueue ( )
default

◆ TaskQueue() [2/3]

template<typename TaskT >
toolbox::util::TaskQueue< TaskT >::TaskQueue ( const TaskQueue< TaskT > &  )
delete

◆ TaskQueue() [3/3]

template<typename TaskT >
toolbox::util::TaskQueue< TaskT >::TaskQueue ( TaskQueue< TaskT > &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ run()

template<typename TaskT >
template<typename FnT >
bool toolbox::util::TaskQueue< TaskT >::run ( FnT  fn)
inline

Wait for and execute the next task in the queue.

Returns
false if the queue was stopped.

Definition at line 47 of file TaskQueue.hpp.

◆ stop()

template<typename TaskT >
void toolbox::util::TaskQueue< TaskT >::stop ( )
inline

Interrupt and exit any inprogress call to run().

Definition at line 70 of file TaskQueue.hpp.

◆ clear()

template<typename TaskT >
void toolbox::util::TaskQueue< TaskT >::clear ( )
inlinenoexcept

Clear task queue.

Definition at line 79 of file TaskQueue.hpp.

◆ push()

template<typename TaskT >
bool toolbox::util::TaskQueue< TaskT >::push ( TaskT &&  task)
inlinenoexcept

Push task onto the task queue.

Definition at line 86 of file TaskQueue.hpp.


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