Base module

icy::Queue

Thread-safe queue container.

Queue

#include <icy/queue.h>

Subclassed by: RunnableQueue< IPacket >, RunnableQueue< PacketT >, PlanarAudioPacket >, PlanarVideoPacket >

Thread-safe queue container.

Public Methods

ReturnNameDescription
voidpush inlineAppends an item to the back of the queue (thread-safe).
voidpush inlineAppends an item to the back of the queue by move (thread-safe).
boolempty const inline#### Returns
Tfront const inline#### Returns
Tback const inline#### Returns
voidpop inlineRemoves the front item from the queue (thread-safe).
voidsort inlineSorts all queued items using the given comparator (thread-safe).
size_tsize const inline#### Returns
std::deque< T >queue const inline#### Returns

push

inline

inline void push(const T & data)

Appends an item to the back of the queue (thread-safe).

Parameters

  • data Item to enqueue.

push

inline

inline void push(T && data)

Appends an item to the back of the queue by move (thread-safe).

Parameters

  • data Item to enqueue.

empty

const inline

inline bool empty() const

Returns

True if the queue contains no items.


front

const inline

inline T front() const

Returns

Copy of the front item.


back

const inline

inline T back() const

Returns

Copy of the back item.


pop

inline

inline void pop()

Removes the front item from the queue (thread-safe).


sort

inline

template<typename Compare> inline void sort()

Sorts all queued items using the given comparator (thread-safe).

Parameters

  • Compare Comparator type compatible with std::sort.

size

const inline

inline size_t size() const

Returns

Number of items currently in the queue (thread-safe).


queue

const inline

inline std::deque< T > queue() const

Returns

Copy of the underlying deque.

Protected Attributes

ReturnNameDescription
std::deque< T >_queue
std::mutex_mutex

_queue

std::deque< T > _queue

_mutex

std::mutex _mutex