Home
Base module

ipc::SyncQueue

IPC synchronization queue is for passing templated actions between threads and the event loop we are synchronizing with.

SyncQueue

#include <icy/ipc.h>
template<typename TAction = ipc::Action>
class SyncQueue

Defined in src/base/include/icy/ipc.h:137

Inherits: Action >

IPC synchronization queue is for passing templated actions between threads and the event loop we are synchronizing with.

List of all members

NameKindOwner
SyncQueuefunctionDeclared here
~SyncQueuefunctionDeclared here
closefunctionDeclared here
postfunctionDeclared here
syncfunctionDeclared here
_syncvariableDeclared here
QueuefunctionInherited from Queue
~QueuefunctionInherited from Queue
pushfunctionInherited from Queue
popfunctionInherited from Queue
runSyncfunctionInherited from Queue
closefunctionInherited from Queue
postfunctionInherited from Queue
waitForSyncfunctionInherited from Queue
_mutexvariableInherited from Queue
_actionsvariableInherited from Queue

Inherited from Queue

KindNameDescription
functionQueue inline
function~Queue virtual inline
functionpush virtual inlinePushes an action onto the queue and triggers a post notification. Takes ownership of action; the queue deletes it after execution. Thread-safe.
functionpop virtual inlineRemoves and returns the next action from the front of the queue. The caller takes ownership of the returned pointer. Thread-safe.
functionrunSync virtual inlineDrains the queue by invoking and deleting every pending action in order. Must be called from the thread that owns the event loop.
functionclose virtual inlineCloses the underlying notification handle. No-op in the base implementation.
functionpost virtual inlineSignals the event loop that new actions are available. No-op in the base implementation.
functionwaitForSync inlineBlocks the calling thread until the queue is empty or the timeout elapses. Polls every 10 ms. Logs a warning if the timeout is reached.
variable_mutex
variable_actions

Public Methods

ReturnNameDescription
SyncQueue inlineConstructs a SyncQueue bound to the given libuv event loop.
voidclose virtual inlineCloses the underlying Synchronizer handle and stops loop wakeups.
voidpost virtual inlineWakes up the event loop so pending actions are dispatched via runSync().
Synchronizer &sync virtual inlineReturns a reference to the internal Synchronizer.

SyncQueue

inline

inline SyncQueue(uv::Loop * loop = uv::defaultLoop())

Defined in src/base/include/icy/ipc.h:142

Constructs a SyncQueue bound to the given libuv event loop.

Parameters

  • loop Event loop to synchronize with (default: the process-wide default loop).

close

virtual inline

virtual inline void close()

Defined in src/base/include/icy/ipc.h:150

Closes the underlying Synchronizer handle and stops loop wakeups.

Reimplements

post

virtual inline

virtual inline void post()

Defined in src/base/include/icy/ipc.h:153

Wakes up the event loop so pending actions are dispatched via runSync().

Reimplements

sync

virtual inline

virtual inline Synchronizer & sync()

Defined in src/base/include/icy/ipc.h:157

Returns a reference to the internal Synchronizer.

Returns

Reference to the Synchronizer used for loop wakeup.

Protected Attributes

ReturnNameDescription
Synchronizer_sync

_sync

Synchronizer _sync

Defined in src/base/include/icy/ipc.h:160