Base module

icy::SyncQueue

[SyncQueue]({#ref classicy_1_1SyncQueue #}) extends [Synchronizer]({#ref classicy_1_1Synchronizer #}) to implement a syn

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

ReturnNameDescription
SyncQueue inline#### Parameters
~SyncQueue virtual inlineDestruction is deferred to allow enough time for all callbacks to return.
voidpush virtual inlinePushes an item onto the queue and wakes the event loop for dispatch. Ownership of item is transferred to the queue.
voidcancel virtual inlineCancels the queue and its underlying synchronizer.
Synchronizer &sync inline#### Returns

SyncQueue

inline

inline SyncQueue(uv::Loop * loop, int limit, int timeout)

Parameters

  • loop Event loop used by the internal [Synchronizer](icy-Synchronizer.html#synchronizer).

  • limit Maximum queued items; oldest are dropped when exceeded.

  • timeout Dispatch 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

  • item Heap-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

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

sync

inline

inline Synchronizer & sync()

Returns

Reference to the underlying [Synchronizer](icy-Synchronizer.html#synchronizer) handle.

Protected Attributes

ReturnNameDescription
Synchronizer_sync

_sync

Synchronizer _sync

Public Types

NameDescription
Queue

Queue

RunnableQueue< T > Queue()