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 SyncQueueDefined 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
| Name | Kind | Owner |
|---|---|---|
SyncQueue | function | Declared here |
~SyncQueue | function | Declared here |
close | function | Declared here |
post | function | Declared here |
sync | function | Declared here |
_sync | variable | Declared here |
Queue | function | Inherited from Queue |
~Queue | function | Inherited from Queue |
push | function | Inherited from Queue |
pop | function | Inherited from Queue |
runSync | function | Inherited from Queue |
close | function | Inherited from Queue |
post | function | Inherited from Queue |
waitForSync | function | Inherited from Queue |
_mutex | variable | Inherited from Queue |
_actions | variable | Inherited from Queue |
Inherited from Queue
| Kind | Name | Description |
|---|---|---|
function | Queue inline | |
function | ~Queue virtual inline | |
function | push virtual inline | Pushes an action onto the queue and triggers a post notification. Takes ownership of action; the queue deletes it after execution. Thread-safe. |
function | pop virtual inline | Removes and returns the next action from the front of the queue. The caller takes ownership of the returned pointer. Thread-safe. |
function | runSync virtual inline | Drains the queue by invoking and deleting every pending action in order. Must be called from the thread that owns the event loop. |
function | close virtual inline | Closes the underlying notification handle. No-op in the base implementation. |
function | post virtual inline | Signals the event loop that new actions are available. No-op in the base implementation. |
function | waitForSync inline | Blocks 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
| Return | Name | Description |
|---|---|---|
SyncQueue inline | Constructs a SyncQueue bound to the given libuv event loop. | |
void | close virtual inline | Closes the underlying Synchronizer handle and stops loop wakeups. |
void | post virtual inline | Wakes up the event loop so pending actions are dispatched via runSync(). |
Synchronizer & | sync virtual inline | Returns 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
loopEvent 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
| Return | Name | Description |
|---|---|---|
Synchronizer | _sync |
_sync
Synchronizer _sync