CppCommon
1.0.4.1
C++ Common Library
|
Named auto-reset event synchronization primitive. More...
#include <named_event_auto_reset.h>
Public Member Functions | |
NamedEventAutoReset (const std::string &name, bool signaled=false) | |
Default class constructor. More... | |
NamedEventAutoReset (const NamedEventAutoReset &)=delete | |
NamedEventAutoReset (NamedEventAutoReset &&event)=delete | |
~NamedEventAutoReset () | |
NamedEventAutoReset & | operator= (const NamedEventAutoReset &)=delete |
NamedEventAutoReset & | operator= (NamedEventAutoReset &&event)=delete |
const std::string & | name () const |
Get the event name. 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... | |
Named auto-reset event synchronization primitive.
Named auto-reset event behaves as a simple auto-reset event but could be shared between processes on the same machine.
Thread-safe.
Definition at line 28 of file named_event_auto_reset.h.
|
explicit |
Default class constructor.
name | - Event name |
signaled | - Signaled event initial state (default is false) |
Definition at line 229 of file named_event_auto_reset.cpp.
|
delete |
|
delete |
CppCommon::NamedEventAutoReset::~NamedEventAutoReset | ( | ) |
Definition at line 240 of file named_event_auto_reset.cpp.
const std::string & CppCommon::NamedEventAutoReset::name | ( | ) | const |
Get the event name.
Definition at line 246 of file named_event_auto_reset.cpp.
|
delete |
|
delete |
void CppCommon::NamedEventAutoReset::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 248 of file named_event_auto_reset.cpp.
bool CppCommon::NamedEventAutoReset::TryWait | ( | ) |
Try to wait the event without block.
Will not block.
Definition at line 250 of file named_event_auto_reset.cpp.
bool CppCommon::NamedEventAutoReset::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 251 of file named_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 79 of file named_event_auto_reset.h.
void CppCommon::NamedEventAutoReset::Wait | ( | ) |
Try to wait the event with block.
Will block.
Definition at line 253 of file named_event_auto_reset.cpp.