![]() |
Kurlyk
|
A thread-safe event queue that supports blocking and non-blocking event retrieval. More...
#include <EventQueue.hpp>
Public Member Functions | |
| void | push_event (T &&event) |
| Adds an event to the queue using move semantics. | |
| void | push_event (const T &event) |
| Adds a copy of an event to the queue and notifies any waiting threads. | |
| T | pop_event () |
| Removes and returns an event from the queue (blocks if the queue is empty). | |
| bool | has_events () const |
| Checks if there are events in the queue. | |
Private Attributes | |
| std::queue< T > | m_events |
| Queue to store events. | |
| std::mutex | m_mutex |
| Mutex to protect queue access. | |
| std::condition_variable | m_cond_var |
| Condition variable for blocking until events are available. | |
A thread-safe event queue that supports blocking and non-blocking event retrieval.
Definition at line 17 of file EventQueue.hpp.
|
inline |
Checks if there are events in the queue.
true if the queue is not empty, otherwise false. Definition at line 47 of file EventQueue.hpp.
|
inline |
Removes and returns an event from the queue (blocks if the queue is empty).
Definition at line 37 of file EventQueue.hpp.
|
inline |
Adds a copy of an event to the queue and notifies any waiting threads.
| event | The event to add to the queue. |
Definition at line 29 of file EventQueue.hpp.
|
inline |
Adds an event to the queue using move semantics.
| event | The event to add to the queue. |
Definition at line 21 of file EventQueue.hpp.
|
private |
Condition variable for blocking until events are available.
Definition at line 55 of file EventQueue.hpp.
|
private |
Queue to store events.
Definition at line 53 of file EventQueue.hpp.
|
mutableprivate |
Mutex to protect queue access.
Definition at line 54 of file EventQueue.hpp.