filesaver
filesaver::data::WorkQueue< T > Class Template Reference

Provides a lock based queue. More...

#include <WorkQueue.h>

Public Member Functions

std::optional< T > frontWithTimeout (std::chrono::milliseconds timeout)
 
front ()
 
void push (const T &item)
 
void push (T &&item)
 
size_t size ()
 

Detailed Description

template<typename T>
class filesaver::data::WorkQueue< T >

Provides a lock based queue.

This is a simple lock based queue.

Definition at line 22 of file WorkQueue.h.

Member Function Documentation

◆ front()

template<typename T >
T filesaver::data::WorkQueue< T >::front ( )
inline

Pop an element from the queue, waiting for until an element is available if it's empty.

Definition at line 60 of file WorkQueue.h.

◆ frontWithTimeout()

template<typename T >
std::optional<T> filesaver::data::WorkQueue< T >::frontWithTimeout ( std::chrono::milliseconds  timeout)
inline

Try to pop an element from the queue, waiting for timeout milliseconds for it to be available.

Parameters
timeoutAmount of time to wait for an element to be available.
Returns
Maybe an element

Definition at line 32 of file WorkQueue.h.

◆ push() [1/2]

template<typename T >
void filesaver::data::WorkQueue< T >::push ( const T &  item)
inline

Push an element into the queue.

Definition at line 82 of file WorkQueue.h.

◆ push() [2/2]

template<typename T >
void filesaver::data::WorkQueue< T >::push ( T &&  item)
inline

Move an element into the queue.

Definition at line 92 of file WorkQueue.h.

◆ size()

template<typename T >
size_t filesaver::data::WorkQueue< T >::size ( )
inline

Get the queue size.

Definition at line 102 of file WorkQueue.h.


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