#include <icy/ipc.h>Subclassed by:
SyncQueue< TAction >
IPC queue is for safely passing templated actions between threads and processes.
| 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. |
inline
inline Queue()virtual inline
virtual inline void push(TAction * action)Pushes an action onto the queue and triggers a post notification. Takes ownership of action; the queue deletes it after execution. Thread-safe.
action Heap-allocated action to enqueue.virtual inline
virtual inline TAction * pop()Removes and returns the next action from the front of the queue. The caller takes ownership of the returned pointer. Thread-safe.
Pointer to the next action, or nullptr if the queue is empty.
virtual inline
virtual inline void runSync()Drains the queue by invoking and deleting every pending action in order. Must be called from the thread that owns the event loop.
virtual inline
virtual inline void close()Closes the underlying notification handle. No-op in the base implementation.
virtual inline
virtual inline void post()Signals the event loop that new actions are available. No-op in the base implementation.
inline
inline void waitForSync(std::chrono::milliseconds timeout)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.
timeout Maximum time to wait (default: 5000 ms).std::mutex _mutexstd::deque< TAction * > _actions