CppCommon
1.0.4.1
C++ Common Library
|
Manual-reset event synchronization primitive. More...
#include <event_manual_reset.h>
Public Member Functions | |
EventManualReset (bool signaled=false) | |
Default class constructor. More... | |
EventManualReset (const EventManualReset &)=delete | |
EventManualReset (EventManualReset &&event)=delete | |
~EventManualReset () | |
EventManualReset & | operator= (const EventManualReset &)=delete |
EventManualReset & | operator= (EventManualReset &&event)=delete |
void | Reset () |
Reset the event. More... | |
void | Signal () |
Signal one of waiting thread about event occurred. More... | |
bool | TryWait () |
Try to wait the event without block. More... | |
bool | TryWaitFor (const Timespan ×pan) |
Try to wait the event for the given timespan. More... | |
bool | TryWaitUntil (const UtcTimestamp ×tamp) |
Try to wait the event until the given timestamp. More... | |
void | Wait () |
Try to wait the event with block. More... | |
Manual-reset event synchronization primitive.
Manual-reset event synchronization primitive allows multiple threads to wait for some event occurred and signal all waiting threads at the time. If the event is in the signaled state no thread will wait for it until the event is reset.
Thread-safe.
https://en.wikipedia.org/wiki/Event_(synchronization_primitive)
Definition at line 28 of file event_manual_reset.h.
|
explicit |
Default class constructor.
signaled | - Signaled event initial state (default is false) |
Definition at line 183 of file event_manual_reset.cpp.
|
delete |
|
delete |
CppCommon::EventManualReset::~EventManualReset | ( | ) |
Definition at line 194 of file event_manual_reset.cpp.
|
delete |
|
delete |
void CppCommon::EventManualReset::Reset | ( | ) |
Reset the event.
If the event is in the signaled state then it will be reset to non signaled state. As the result other threads that wait for the event will be blocked.
Will not block.
Definition at line 200 of file event_manual_reset.cpp.
void CppCommon::EventManualReset::Signal | ( | ) |
Signal one of waiting thread about event occurred.
If some threads are waiting for the event all of them will be signaled and continued.
Will not block.
Definition at line 201 of file event_manual_reset.cpp.
bool CppCommon::EventManualReset::TryWait | ( | ) |
Try to wait the event without block.
Will not block.
Definition at line 203 of file event_manual_reset.cpp.
bool CppCommon::EventManualReset::TryWaitFor | ( | const Timespan & | timespan | ) |
Try to wait the event for the given timespan.
Will block for the given timespan in the worst case.
timespan | - Timespan to wait for the event |
Definition at line 204 of file event_manual_reset.cpp.
|
inline |
Try to wait the event until the given timestamp.
Will block until the given timestamp in the worst case.
timestamp | - Timestamp to stop wait for the event |
Definition at line 83 of file event_manual_reset.h.
void CppCommon::EventManualReset::Wait | ( | ) |
Try to wait the event with block.
Will block.
Definition at line 206 of file event_manual_reset.cpp.