#include <icy/queue.h>Inherits:
Queue< T * >,RunnableSubclassed by:AsyncQueue< IPacket >,AsyncQueue< PacketT >,PlanarAudioPacket >,PlanarVideoPacket >,SyncQueue< IPacket >,AsyncQueue< T >,SyncQueue< T >
Queue of runnable tasks for sequential execution.
| Return | Name | Description |
|---|---|---|
std::function< void(T &)> | ondispatch | The default dispatch function. Must be set before the queue is running. |
std::function< void(T &)> ondispatchThe default dispatch function. Must be set before the queue is running.
| Return | Name | Description |
|---|---|---|
RunnableQueue inline | #### Parameters | |
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 | 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 | #### Returns |
void | setTimeout inline | Sets the dispatch timeout. Must only be called when the queue is empty. |
size_t | dropped const inline | #### Returns |
inline
inline RunnableQueue(int limit, int timeout)limit Maximum number of queued items; oldest are purged when exceeded (0 = unlimited).
timeout Dispatch timeout in milliseconds; 0 means run until cancel() is called.
virtual inline
virtual inline void push(T * item)Push an item onto the queue. The queue takes ownership of the item pointer.
virtual inline
virtual inline void flush()Flush all outgoing items.
inline
inline void clear()virtual inline
virtual inline void run()Called asynchronously to dispatch queued items. If not timeout is set this method blocks until cancel() is called, otherwise runTimeout() will be called.
virtual inline
virtual inline void runTimeout()Called asynchronously to dispatch queued items until the queue is empty or the timeout expires. Pseudo protected for std::bind compatability.
virtual inline
virtual inline void dispatch(T & item)Dispatch a single item to listeners.
inline
inline int timeout()Current dispatch timeout in milliseconds.
inline
inline void setTimeout(int milliseconds)Sets the dispatch timeout. Must only be called when the queue is empty.
milliseconds New timeout in milliseconds.std::logic_error if the queue is non-empty.const inline
inline size_t dropped() constNumber of items purged because the queue limit was exceeded.
int _limitint _timeoutsize_t _dropped = 0| 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(const RunnableQueue &) = deleteDeleted constructor.
RunnableQueue(RunnableQueue &&) = deleteDeleted constructor.
virtual inline
virtual inline T * popNext()Pops the next waiting item.
virtual inline
virtual inline bool dispatchNext()Pops and dispatches the next waiting item.