25 #ifndef INCLUDED_SignalEvent_h_GUID_DD338B8E_2CC9_43B8_0699_13169941BD2E 26 #define INCLUDED_SignalEvent_h_GUID_DD338B8E_2CC9_43B8_0699_13169941BD2E 37 #define WIN32_LEAN_AND_MEAN 49 : h_(CreateEvent(nullptr, manual, false, nullptr)) {
51 throw std::runtime_error(
"Could not create Windows event handle!");
58 void set() { SetEvent(h_); }
61 void clear() { ResetEvent(h_); }
64 bool wait() {
return WAIT_OBJECT_0 == WaitForSingleObject(h_, INFINITE); }
69 bool wait(DWORD milliseconds) {
70 return WAIT_OBJECT_0 == WaitForSingleObject(h_, milliseconds);
79 #endif // INCLUDED_SignalEvent_h_GUID_DD338B8E_2CC9_43B8_0699_13169941BD2E ~SignalEvent()
Destructor.
Definition: SignalEvent.h:56
bool wait(DWORD milliseconds)
Wait for the event, with a timeout.
Definition: SignalEvent.h:69
Handy little low-level sync primitive An automatic reset event restores to "un-signalled" after relea...
Definition: SignalEvent.h:45
SignalEvent(bool manual=false)
Constructor.
Definition: SignalEvent.h:48
void clear()
Un-signal the event (not usually necessary for auto=reset events)
Definition: SignalEvent.h:61
bool wait()
Wait for the event, infinitely.
Definition: SignalEvent.h:64