icy::SyncQueue
SyncQueue
#include <icy/queue.h>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.
Public Methods
| Return | Name | Description |
|---|---|---|
SyncQueue inline | #### Parameters | |
~SyncQueue virtual inline | Destruction is deferred to allow enough time for all callbacks to return. | |
void | push virtual inline | 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 | Cancels the queue and its underlying synchronizer. |
Synchronizer & | sync inline | #### Returns |
SyncQueue
inline
inline SyncQueue(uv::Loop * loop, int limit, int timeout)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()Destruction is deferred to allow enough time for all callbacks to return.
push
virtual inline
virtual inline void push(T * item)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.
cancel
virtual inline
virtual inline void cancel(bool flag)Cancels the queue and its underlying synchronizer.
Parameters
flagTrue to cancel, false to un-cancel.
sync
inline
inline Synchronizer & sync()Returns
Reference to the underlying [Synchronizer](icy-Synchronizer.html#synchronizer) handle.
Protected Attributes
| Return | Name | Description |
|---|---|---|
Synchronizer | _sync |
_sync
Synchronizer _syncPublic Types
| Name | Description |
|---|---|
Queue |
Queue
RunnableQueue< T > Queue()