RunnableQueue
RunnableQueue
#include <icy/queue.h>template<class T>
class RunnableQueueDefined in src/base/include/icy/queue.h:113
Inherits:
Queue< T * >,RunnableSubclassed by:AsyncQueue< IPacket >,AsyncQueue< PacketT >,PlanarAudioPacket >,AsyncQueue< VisionFramePacket >,SyncQueue< IPacket >,AsyncQueue< T >,SyncQueue< T >
Queue of runnable tasks for sequential execution.
List of all members
| Name | Kind | Owner |
|---|---|---|
ondispatch | variable | Declared here |
RunnableQueue | function | Declared here |
~RunnableQueue | function | Declared here |
push | function | Declared here |
flush | function | Declared here |
clear | function | Declared here |
run | function | Declared here |
runTimeout | function | Declared here |
dispatch | function | Declared here |
timeout | function | Declared here |
setTimeout | function | Declared here |
dropped | function | Declared here |
_limit | variable | Declared here |
_timeout | variable | Declared here |
_dropped | variable | Declared here |
RunnableQueue | function | Declared here |
operator= | function | Declared here |
RunnableQueue | function | Declared here |
operator= | function | Declared here |
popNext | function | Declared here |
dispatchNext | function | Declared here |
push | function | Inherited from Queue |
push | function | Inherited from Queue |
empty | function | Inherited from Queue |
front | function | Inherited from Queue |
back | function | Inherited from Queue |
pop | function | Inherited from Queue |
sort | function | Inherited from Queue |
size | function | Inherited from Queue |
queue | function | Inherited from Queue |
_queue | variable | Inherited from Queue |
_mutex | variable | Inherited from Queue |
Runnable | function | Inherited from Runnable |
~Runnable | function | Inherited from Runnable |
run | function | Inherited from Runnable |
cancel | function | Inherited from Runnable |
cancelled | function | Inherited from Runnable |
exit | variable | Inherited from Runnable |
Inherited from Queue
| Kind | Name | Description |
|---|---|---|
function | push inline | Appends an item to the back of the queue (thread-safe). |
function | push inline | Appends an item to the back of the queue by move (thread-safe). |
function | empty const inline | |
function | front const inline | |
function | back const inline | |
function | pop inline | Removes the front item from the queue (thread-safe). |
function | sort inline | Sorts all queued items using the given comparator (thread-safe). |
function | size const inline | |
function | queue const inline | |
variable | _queue | |
variable | _mutex |
Inherited from Runnable
| Kind | Name | Description |
|---|---|---|
function | Runnable inline | |
function | ~Runnable virtual | Defaulted destructor. |
function | run virtual | The run method will be called by the asynchronous context. |
function | cancel virtual inline | Cancel the current task. The run() method should return ASAP. |
function | cancelled virtual const inline | Returns true when the task has been cancelled. |
variable | exit |
Public Attributes
| Return | Name | Description |
|---|---|---|
std::function< void(T &)> | ondispatch | The default dispatch function. Must be set before the queue is running. |
ondispatch
std::function< void(T &)> ondispatchDefined in src/base/include/icy/queue.h:119
The default dispatch function. Must be set before the queue is running.
Public Methods
| Return | Name | Description |
|---|---|---|
RunnableQueue inline | ||
void | push virtual inline | Push an item onto the queue. The queue takes ownership of the item pointer. |
void | flush virtual inline | Flush all outgoing items. |
void | clear inline | |
void | run virtual inline override | Called asynchronously to dispatch queued items. If not timeout is set this method blocks until cancel() is called, otherwise runTimeout() will be called. |
void | runTimeout virtual inline | Called asynchronously to dispatch queued items until the queue is empty or the timeout expires. Pseudo protected for std::bind compatability. |
void | dispatch virtual inline | Dispatch a single item to listeners. |
int | timeout inline | |
void | setTimeout inline | Sets the dispatch timeout. Must only be called when the queue is empty. |
size_t | dropped const inline |
RunnableQueue
inline
inline RunnableQueue(int limit = 2048, int timeout = 0)Defined in src/base/include/icy/queue.h:123
Parameters
limitMaximum number of queued items; oldest are purged when exceeded (0 = unlimited).timeoutDispatch timeout in milliseconds; 0 means run until cancel() is called.
push
virtual inline
virtual inline void push(T * item)Defined in src/base/include/icy/queue.h:136
Push an item onto the queue. The queue takes ownership of the item pointer.
Reimplemented by
flush
virtual inline
virtual inline void flush()Defined in src/base/include/icy/queue.h:151
Flush all outgoing items.
clear
inline
inline void clear()Defined in src/base/include/icy/queue.h:169
run
virtual inline override
virtual inline void run() overrideDefined in src/base/include/icy/queue.h:181
Called asynchronously to dispatch queued items. If not timeout is set this method blocks until cancel() is called, otherwise runTimeout() will be called.
Reimplements
runTimeout
virtual inline
virtual inline void runTimeout()Defined in src/base/include/icy/queue.h:196
Called asynchronously to dispatch queued items until the queue is empty or the timeout expires. Pseudo protected for std::bind compatability.
dispatch
virtual inline
virtual inline void dispatch(T & item)Defined in src/base/include/icy/queue.h:206
Dispatch a single item to listeners.
Reimplemented by
timeout
inline
inline int timeout()Defined in src/base/include/icy/queue.h:213
Returns
Current dispatch timeout in milliseconds.
setTimeout
inline
inline void setTimeout(int milliseconds)Defined in src/base/include/icy/queue.h:222
Sets the dispatch timeout. Must only be called when the queue is empty.
Parameters
millisecondsNew timeout in milliseconds.
Exceptions
std::logic_errorif the queue is non-empty.
dropped
const inline
inline size_t dropped() constDefined in src/base/include/icy/queue.h:231
Returns
Number of items purged because the queue limit was exceeded.
Protected Attributes
_limit
int _limitDefined in src/base/include/icy/queue.h:270
_timeout
int _timeoutDefined in src/base/include/icy/queue.h:271
_dropped
size_t _dropped = 0Defined in src/base/include/icy/queue.h:272
Protected Methods
| Return | Name | Description |
|---|---|---|
RunnableQueue | Deleted constructor. | |
RunnableQueue | Deleted constructor. | |
T * | popNext virtual inline | Pops the next waiting item. |
bool | dispatchNext virtual inline | Pops and dispatches the next waiting item. |
RunnableQueue
RunnableQueue(const RunnableQueue &) = deleteDefined in src/base/include/icy/queue.h:238
Deleted constructor.
RunnableQueue
RunnableQueue(RunnableQueue &&) = deleteDefined in src/base/include/icy/queue.h:240
Deleted constructor.
popNext
virtual inline
virtual inline T * popNext()Defined in src/base/include/icy/queue.h:244
Pops the next waiting item.
Reimplemented by
dispatchNext
virtual inline
virtual inline bool dispatchNext()Defined in src/base/include/icy/queue.h:259
Pops and dispatches the next waiting item.
