SyncQueue
SyncQueue
#include <icy/queue.h>template<class T>
class SyncQueueDefined in src/base/include/icy/queue.h:285
Inherits:
RunnableQueue< T >Subclassed by:SyncPacketQueue< T >
SyncQueue extends Synchronizer to implement a synchronized FIFO queue which receives T objects from any thread and synchronizes them for safe consumption by the associated event loop.
List of all members
| Name | Kind | Owner |
|---|---|---|
SyncQueue | function | Declared here |
~SyncQueue | function | Declared here |
push | function | Declared here |
cancel | function | Declared here |
sync | function | Declared here |
_sync | variable | Declared here |
Queue | typedef | Declared here |
ondispatch | variable | Inherited from RunnableQueue |
RunnableQueue | function | Inherited from RunnableQueue |
~RunnableQueue | function | Inherited from RunnableQueue |
push | function | Inherited from RunnableQueue |
flush | function | Inherited from RunnableQueue |
clear | function | Inherited from RunnableQueue |
run | function | Inherited from RunnableQueue |
runTimeout | function | Inherited from RunnableQueue |
dispatch | function | Inherited from RunnableQueue |
timeout | function | Inherited from RunnableQueue |
setTimeout | function | Inherited from RunnableQueue |
dropped | function | Inherited from RunnableQueue |
_limit | variable | Inherited from RunnableQueue |
_timeout | variable | Inherited from RunnableQueue |
_dropped | variable | Inherited from RunnableQueue |
RunnableQueue | function | Inherited from RunnableQueue |
operator= | function | Inherited from RunnableQueue |
RunnableQueue | function | Inherited from RunnableQueue |
operator= | function | Inherited from RunnableQueue |
popNext | function | Inherited from RunnableQueue |
dispatchNext | function | Inherited from RunnableQueue |
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 RunnableQueue
| Kind | Name | Description |
|---|---|---|
variable | ondispatch | The default dispatch function. Must be set before the queue is running. |
function | RunnableQueue inline | |
function | ~RunnableQueue virtual inline | |
function | push virtual inline | Push an item onto the queue. The queue takes ownership of the item pointer. |
function | flush virtual inline | Flush all outgoing items. |
function | clear inline | |
function | 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. |
function | runTimeout virtual inline | Called asynchronously to dispatch queued items until the queue is empty or the timeout expires. Pseudo protected for std::bind compatability. |
function | dispatch virtual inline | Dispatch a single item to listeners. |
function | timeout inline | |
function | setTimeout inline | Sets the dispatch timeout. Must only be called when the queue is empty. |
function | dropped const inline | |
variable | _limit | |
variable | _timeout | |
variable | _dropped | |
function | RunnableQueue | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | RunnableQueue | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | popNext virtual inline | Pops the next waiting item. |
function | dispatchNext virtual inline | Pops and dispatches the next waiting item. |
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 Methods
| Return | Name | Description |
|---|---|---|
SyncQueue inline | ||
~SyncQueue virtual inline | Destruction is deferred to allow enough time for all callbacks to return. | |
void | push virtual inline override | Pushes an item onto the queue and wakes the event loop for dispatch. Ownership of item is transferred to the queue. |
void | cancel virtual inline override | Cancels the queue and its underlying synchronizer. |
Synchronizer & | sync inline |
SyncQueue
inline
inline SyncQueue(uv::Loop * loop, int limit = 2048, int timeout = 20)Defined in src/base/include/icy/queue.h:293
Parameters
loopEvent loop used by the internal[Synchronizer](icy-Synchronizer.html#synchronizer).limitMaximum queued items; oldest are dropped when exceeded.timeoutDispatch timeout in milliseconds passed to[RunnableQueue](icy-RunnableQueue.html#runnablequeue).
~SyncQueue
virtual inline
virtual inline ~SyncQueue()Defined in src/base/include/icy/queue.h:301
Destruction is deferred to allow enough time for all callbacks to return.
push
virtual inline override
virtual inline void push(T * item) overrideDefined in src/base/include/icy/queue.h:308
Pushes an item onto the queue and wakes the event loop for dispatch. Ownership of item is transferred to the queue.
Parameters
itemHeap-allocated item to enqueue; the queue takes ownership.
Reimplements
cancel
virtual inline override
virtual inline void cancel(bool flag = true) overrideDefined in src/base/include/icy/queue.h:316
Cancels the queue and its underlying synchronizer.
Parameters
flagTrue to cancel, false to un-cancel.
Reimplements
sync
inline
inline Synchronizer & sync()Defined in src/base/include/icy/queue.h:326
Returns
Reference to the underlying [Synchronizer](icy-Synchronizer.html#synchronizer) handle.
Protected Attributes
| Return | Name | Description |
|---|---|---|
Synchronizer | _sync |
_sync
Synchronizer _syncDefined in src/base/include/icy/queue.h:329
Public Types
| Name | Description |
|---|---|
Queue |
Queue
using Queue = RunnableQueue< T >