ipc::Queue
Queue
#include <icy/ipc.h>template<typename TAction = ipc::Action>
class QueueDefined in src/base/include/icy/ipc.h:57
Subclassed by:
SyncQueue< TAction >
IPC queue is for safely passing templated actions between threads and processes.
List of all members
| Name | Kind | Owner |
|---|---|---|
Queue | function | Declared here |
~Queue | function | Declared here |
push | function | Declared here |
pop | function | Declared here |
runSync | function | Declared here |
close | function | Declared here |
post | function | Declared here |
waitForSync | function | Declared here |
_mutex | variable | Declared here |
_actions | variable | Declared here |
Public Methods
| Return | Name | Description |
|---|---|---|
Queue inline | ||
void | 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. |
TAction * | 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. |
void | 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. |
void | close virtual inline | Closes the underlying notification handle. No-op in the base implementation. |
void | post virtual inline | Signals the event loop that new actions are available. No-op in the base implementation. |
void | 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. |
Queue
inline
inline Queue()Defined in src/base/include/icy/ipc.h:60
push
virtual inline
virtual inline void push(TAction * action)Defined in src/base/include/icy/ipc.h:68
Pushes an action onto the queue and triggers a post notification. Takes ownership of action; the queue deletes it after execution. Thread-safe.
Parameters
actionHeap-allocated action to enqueue.
pop
virtual inline
virtual inline TAction * pop()Defined in src/base/include/icy/ipc.h:81
Removes and returns the next action from the front of the queue. The caller takes ownership of the returned pointer. Thread-safe.
Returns
Pointer to the next action, or nullptr if the queue is empty.
runSync
virtual inline
virtual inline void runSync()Defined in src/base/include/icy/ipc.h:93
Drains the queue by invoking and deleting every pending action in order. Must be called from the thread that owns the event loop.
close
virtual inline
virtual inline void close()Defined in src/base/include/icy/ipc.h:103
Closes the underlying notification handle. No-op in the base implementation.
Reimplemented by
post
virtual inline
virtual inline void post()Defined in src/base/include/icy/ipc.h:106
Signals the event loop that new actions are available. No-op in the base implementation.
Reimplemented by
waitForSync
inline
inline void waitForSync(std::chrono::milliseconds timeout = std::chrono::milliseconds(5000))Defined in src/base/include/icy/ipc.h:111
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.
Parameters
timeoutMaximum time to wait (default: 5000 ms).
Protected Attributes
_mutex
std::mutex _mutexDefined in src/base/include/icy/ipc.h:127
_actions
std::deque< TAction * > _actions