CppCommon
1.0.4.1
C++ Common Library
|
Auto-reset event synchronization primitive. More...
#include <event_auto_reset.h>
Public Member Functions | |
EventAutoReset (bool signaled=false) | |
Default class constructor. More... | |
EventAutoReset (const EventAutoReset &)=delete | |
EventAutoReset (EventAutoReset &&event)=delete | |
~EventAutoReset () | |
EventAutoReset & | operator= (const EventAutoReset &)=delete |
EventAutoReset & | operator= (EventAutoReset &&event)=delete |
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... | |
Auto-reset event synchronization primitive.
Auto-reset event synchronization primitive allows multiple threads to wait for some event occurred and signal only one thread at the time. Other thread will wait for the next event signalization. The order of thread signalization by auto-reset event is not guaranteed.
Thread-safe.
https://en.wikipedia.org/wiki/Event_(synchronization_primitive)
Definition at line 28 of file event_auto_reset.h.
|
explicit |
Default class constructor.
signaled | - Signaled event initial state (default is false) |
Definition at line 170 of file event_auto_reset.cpp.
|
delete |
|
delete |
CppCommon::EventAutoReset::~EventAutoReset | ( | ) |
Definition at line 181 of file event_auto_reset.cpp.
|
delete |
|
delete |
void CppCommon::EventAutoReset::Signal | ( | ) |
Signal one of waiting thread about event occurred.
If some threads are waiting for the event one will be chosen, signaled and continued. The order of thread signalization by auto-reset event is not guaranteed.
Will not block.
Definition at line 187 of file event_auto_reset.cpp.
bool CppCommon::EventAutoReset::TryWait | ( | ) |
Try to wait the event without block.
Will not block.
Definition at line 189 of file event_auto_reset.cpp.
bool CppCommon::EventAutoReset::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 190 of file event_auto_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 75 of file event_auto_reset.h.
void CppCommon::EventAutoReset::Wait | ( | ) |