Home
Base module

AsyncQueue

AsyncQueue is a thread-based queue which receives packets from any thread source and dispatches them asynchronously.

AsyncQueue

#include <icy/queue.h>
template<class T>
class AsyncQueue

Defined in src/base/include/icy/queue.h:347

Inherits: RunnableQueue< T > Subclassed by: AsyncPacketQueue< PacketT >, PlanarAudioPacket >, AsyncPacketQueue< VisionFramePacket >, AsyncPacketQueue< T >

AsyncQueue is a thread-based queue which receives packets from any thread source and dispatches them asynchronously.

This queue is useful for deferring load from operation critical system devices before performing long running tasks.

The thread will call the RunnableQueue's run() method to constantly flush outgoing packets until cancel() is called.

List of all members

NameKindOwner
AsyncQueuefunctionDeclared here
cancelfunctionDeclared here
_threadvariableDeclared here
~AsyncQueuefunctionDeclared here
QueuetypedefDeclared here
ondispatchvariableInherited from RunnableQueue
RunnableQueuefunctionInherited from RunnableQueue
~RunnableQueuefunctionInherited from RunnableQueue
pushfunctionInherited from RunnableQueue
flushfunctionInherited from RunnableQueue
clearfunctionInherited from RunnableQueue
runfunctionInherited from RunnableQueue
runTimeoutfunctionInherited from RunnableQueue
dispatchfunctionInherited from RunnableQueue
timeoutfunctionInherited from RunnableQueue
setTimeoutfunctionInherited from RunnableQueue
droppedfunctionInherited from RunnableQueue
_limitvariableInherited from RunnableQueue
_timeoutvariableInherited from RunnableQueue
_droppedvariableInherited from RunnableQueue
RunnableQueuefunctionInherited from RunnableQueue
operator=functionInherited from RunnableQueue
RunnableQueuefunctionInherited from RunnableQueue
operator=functionInherited from RunnableQueue
popNextfunctionInherited from RunnableQueue
dispatchNextfunctionInherited from RunnableQueue
pushfunctionInherited from Queue
pushfunctionInherited from Queue
emptyfunctionInherited from Queue
frontfunctionInherited from Queue
backfunctionInherited from Queue
popfunctionInherited from Queue
sortfunctionInherited from Queue
sizefunctionInherited from Queue
queuefunctionInherited from Queue
_queuevariableInherited from Queue
_mutexvariableInherited from Queue
RunnablefunctionInherited from Runnable
~RunnablefunctionInherited from Runnable
runfunctionInherited from Runnable
cancelfunctionInherited from Runnable
cancelledfunctionInherited from Runnable
exitvariableInherited from Runnable

Inherited from RunnableQueue

KindNameDescription
variableondispatchThe default dispatch function. Must be set before the queue is running.
functionRunnableQueue inline
function~RunnableQueue virtual inline
functionpush virtual inlinePush an item onto the queue. The queue takes ownership of the item pointer.
functionflush virtual inlineFlush all outgoing items.
functionclear inline
functionrun virtual inline overrideCalled asynchronously to dispatch queued items. If not timeout is set this method blocks until cancel() is called, otherwise runTimeout() will be called.
functionrunTimeout virtual inlineCalled asynchronously to dispatch queued items until the queue is empty or the timeout expires. Pseudo protected for std::bind compatability.
functiondispatch virtual inlineDispatch a single item to listeners.
functiontimeout inline
functionsetTimeout inlineSets the dispatch timeout. Must only be called when the queue is empty.
functiondropped const inline
variable_limit
variable_timeout
variable_dropped
functionRunnableQueueDeleted constructor.
functionoperator=Deleted assignment operator.
functionRunnableQueueDeleted constructor.
functionoperator=Deleted assignment operator.
functionpopNext virtual inlinePops the next waiting item.
functiondispatchNext virtual inlinePops and dispatches the next waiting item.

Inherited from Queue

KindNameDescription
functionpush inlineAppends an item to the back of the queue (thread-safe).
functionpush inlineAppends an item to the back of the queue by move (thread-safe).
functionempty const inline
functionfront const inline
functionback const inline
functionpop inlineRemoves the front item from the queue (thread-safe).
functionsort inlineSorts all queued items using the given comparator (thread-safe).
functionsize const inline
functionqueue const inline
variable_queue
variable_mutex

Inherited from Runnable

KindNameDescription
functionRunnable inline
function~Runnable virtualDefaulted destructor.
functionrun virtualThe run method will be called by the asynchronous context.
functioncancel virtual inlineCancel the current task. The run() method should return ASAP.
functioncancelled virtual const inlineReturns true when the task has been cancelled.
variableexit

Public Methods

ReturnNameDescription
AsyncQueue inline
voidcancel virtual inline overrideCancels the queue and joins the dispatch thread.

AsyncQueue

inline

inline AsyncQueue(int limit = 2048)

Defined in src/base/include/icy/queue.h:353

Parameters

  • limit Maximum number of queued items before oldest are dropped.

cancel

virtual inline override

virtual inline void cancel(bool flag = true) override

Defined in src/base/include/icy/queue.h:361

Cancels the queue and joins the dispatch thread.

Parameters

  • flag True to cancel, false to un-cancel.
Reimplements

Protected Attributes

ReturnNameDescription
Thread_thread

_thread

Thread _thread

Defined in src/base/include/icy/queue.h:372

Public Types

NameDescription
Queue

Queue

using Queue = RunnableQueue< T >

Defined in src/base/include/icy/queue.h:350