|
Zappy GUI
C++ graphic client: renderer, camera, network
|
Thread-safe queue for storing events received from the server. Allows for potential multi-threaded behavior between GUI layers. Not strictly necessary, good to have, future proof. More...
#include <EventQueue.hpp>
Collaboration diagram for EventQueue:Public Member Functions | |
| void | push (Event event) |
| Pushes an event to the queue. Thread safe. | |
| std::optional< Event > | pop () |
| Pops an event from the queue. Thread safe. | |
| void | clear () |
| Clears all pending events from the queue. Thread safe. | |
Private Attributes | |
| std::queue< Event > | _queue |
| std::mutex | _mutex |
Thread-safe queue for storing events received from the server. Allows for potential multi-threaded behavior between GUI layers. Not strictly necessary, good to have, future proof.
Definition at line 14 of file EventQueue.hpp.
| void EventQueue::clear | ( | ) |
Clears all pending events from the queue. Thread safe.
Definition at line 19 of file EventQueue.cpp.
References _mutex, and _queue.
Referenced by App::run().
Here is the caller graph for this function:| std::optional< Event > EventQueue::pop | ( | ) |
Pops an event from the queue. Thread safe.
Definition at line 9 of file EventQueue.cpp.
References _mutex, and _queue.
Referenced by App::run().
Here is the caller graph for this function:| void EventQueue::push | ( | Event | event | ) |
Pushes an event to the queue. Thread safe.
| event | The event to push. |
Definition at line 3 of file EventQueue.cpp.
References _mutex, and _queue.
Referenced by App::pollAndEnqueue().
Here is the caller graph for this function:
|
private |
Definition at line 38 of file EventQueue.hpp.
|
private |
Definition at line 37 of file EventQueue.hpp.