CppCommon  1.0.4.1
C++ Common Library
Public Member Functions | List of all members
CppCommon::NamedEventManualReset Class Reference

Named manual-reset event synchronization primitive. More...

#include <named_event_manual_reset.h>

Public Member Functions

 NamedEventManualReset (const std::string &name, bool signaled=false)
 Default class constructor. More...
 
 NamedEventManualReset (const NamedEventManualReset &)=delete
 
 NamedEventManualReset (NamedEventManualReset &&event)=delete
 
 ~NamedEventManualReset ()
 
NamedEventManualResetoperator= (const NamedEventManualReset &)=delete
 
NamedEventManualResetoperator= (NamedEventManualReset &&event)=delete
 
const std::string & name () const
 Get the event name. More...
 
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 &timespan)
 Try to wait the event for the given timespan. More...
 
bool TryWaitUntil (const UtcTimestamp &timestamp)
 Try to wait the event until the given timestamp. More...
 
void Wait ()
 Try to wait the event with block. More...
 

Detailed Description

Named manual-reset event synchronization primitive.

Named manual-reset event behaves as a simple manual-reset event but could be shared between processes on the same machine.

Thread-safe.

See also
EventManualReset
Examples
threads_named_event_manual_reset.cpp.

Definition at line 28 of file named_event_manual_reset.h.

Constructor & Destructor Documentation

◆ NamedEventManualReset() [1/3]

CppCommon::NamedEventManualReset::NamedEventManualReset ( const std::string &  name,
bool  signaled = false 
)
explicit

Default class constructor.

Parameters
name- Event name
signaled- Signaled event initial state (default is false)

Definition at line 244 of file named_event_manual_reset.cpp.

◆ NamedEventManualReset() [2/3]

CppCommon::NamedEventManualReset::NamedEventManualReset ( const NamedEventManualReset )
delete

◆ NamedEventManualReset() [3/3]

CppCommon::NamedEventManualReset::NamedEventManualReset ( NamedEventManualReset &&  event)
delete

◆ ~NamedEventManualReset()

CppCommon::NamedEventManualReset::~NamedEventManualReset ( )

Definition at line 255 of file named_event_manual_reset.cpp.

Member Function Documentation

◆ name()

const std::string & CppCommon::NamedEventManualReset::name ( ) const

Get the event name.

Definition at line 261 of file named_event_manual_reset.cpp.

◆ operator=() [1/2]

NamedEventManualReset& CppCommon::NamedEventManualReset::operator= ( const NamedEventManualReset )
delete

◆ operator=() [2/2]

NamedEventManualReset& CppCommon::NamedEventManualReset::operator= ( NamedEventManualReset &&  event)
delete

◆ Reset()

void CppCommon::NamedEventManualReset::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 263 of file named_event_manual_reset.cpp.

◆ Signal()

void CppCommon::NamedEventManualReset::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.

Examples
threads_named_event_manual_reset.cpp.

Definition at line 264 of file named_event_manual_reset.cpp.

◆ TryWait()

bool CppCommon::NamedEventManualReset::TryWait ( )

Try to wait the event without block.

Will not block.

Returns
'true' if the event was occurred before and no other threads were signaled, 'false' if the event was not occurred before

Definition at line 266 of file named_event_manual_reset.cpp.

◆ TryWaitFor()

bool CppCommon::NamedEventManualReset::TryWaitFor ( const Timespan timespan)

Try to wait the event for the given timespan.

Will block for the given timespan in the worst case.

Parameters
timespan- Timespan to wait for the event
Returns
'true' if the event was occurred, 'false' if the event was not occurred

Definition at line 267 of file named_event_manual_reset.cpp.

◆ TryWaitUntil()

bool CppCommon::NamedEventManualReset::TryWaitUntil ( const UtcTimestamp timestamp)
inline

Try to wait the event until the given timestamp.

Will block until the given timestamp in the worst case.

Parameters
timestamp- Timestamp to stop wait for the event
Returns
'true' if the event was occurred, 'false' if the event was not occurred

Definition at line 87 of file named_event_manual_reset.h.

◆ Wait()

void CppCommon::NamedEventManualReset::Wait ( )

Try to wait the event with block.

Will block.

Examples
threads_named_event_manual_reset.cpp.

Definition at line 269 of file named_event_manual_reset.cpp.


The documentation for this class was generated from the following files: