ngscopeclient 0.1-dev+51fbda87c
|
Synchronization primitive for sending a "something is ready" notification to a thread. More...
#include <Event.h>
Public Member Functions | |
void | Signal () |
Sends an event to the receiving thread. | |
bool | SignalIfNotAlreadySignaled () |
Sends an event to the receiving thread. More... | |
void | SignalExactlyOnce (Event &processedEvent) |
Sends an event to the receiving thread. More... | |
void | Block () |
Blocks until the event is signaled. | |
bool | Peek (bool clearReady=true) |
Checks if the event is signaled, and returns immediately without blocking regardless of event state. More... | |
void | Clear () |
Clears the event state if it's currently signaled. | |
Protected Attributes | |
std::mutex | m_mutex |
std::condition_variable | m_cond |
std::atomic_bool | m_ready |
Synchronization primitive for sending a "something is ready" notification to a thread.
Unlike std::condition_variable, an Event can be signaled before the receiver has started to wait.
|
inline |
Checks if the event is signaled, and returns immediately without blocking regardless of event state.
This clears the event-pending flag if clearReady is set.
|
inline |
Sends an event to the receiving thread.
If another event is pending, blocks until that one has been processed to avoid dropping events.
processedEvent | Event indicating that the previous message has been processed completely |
|
inline |
Sends an event to the receiving thread.
If another event is pending, returns false indicating no submission was actually made