Base Framework
Public Member Functions | List of all members
Event Class Reference

Event signaling mechanism. More...

#include <base/concurrency/Event.h>

Inherits Resource.

Public Member Functions

 Event ()
 
 Event (NullPtr) noexcept
 
bool isSignaled () const
 
void reset ()
 
void signal ()
 
void wait () const
 
bool wait (unsigned int microseconds) const
 
OperatingSystem::Handle getHandle () const noexcept
 
 ~Event ()
 
- Public Member Functions inherited from Resource
String getDescription () const
 
void setDescription (const String &description)
 
unsigned int getResourceId () const
 
unsigned int getCreatedById () const
 
AnyReference getHandle () const noexcept
 
template<class TYPE >
TYPE & getInternalHandle () const
 
 operator bool () const noexcept
 

Additional Inherited Members

- Protected Attributes inherited from Resource
AnyReference handle
 

Detailed Description

Event signaling mechanism.

This class provides support for threads to wait for signals.

Version
1.3

Constructor & Destructor Documentation

◆ Event() [1/2]

Event::Event ( )
explicit

Initializes the event in the non-signaled state.

◆ Event() [2/2]

Event::Event ( NullPtr  )
inlineexplicitnoexcept

Initializes the event as invalid.

◆ ~Event()

Event::~Event ( )

Destroys the event object.

Member Function Documentation

◆ getHandle()

OperatingSystem::Handle Event::getHandle ( ) const
noexcept

Returns the event handle. Not supported by all platforms in which case nullptr is returned.

◆ isSignaled()

bool Event::isSignaled ( ) const

Returns true if this event is in the signaled state.

◆ reset()

void Event::reset ( )

Resets the event. Returns when all waiting threads.

◆ signal()

void Event::signal ( )

Signal the waiting threads. Control is returned immediately.

◆ wait() [1/2]

void Event::wait ( ) const

Waits for signal. The executing thread is suspended until event is signaled. Will wait forever if the event is never signaled. Raises an Overflow exception if the maximum number of waiting threads is exceeded.

◆ wait() [2/2]

bool Event::wait ( unsigned int  microseconds) const

Waits for the event to be signaled. The executing thread is suspended until the event is signaled or the specified time-out interval expires. May throw an 'Overflow' exception if the maximum number of waiting threads is exceeded.

Parameters
microsecondsThe desired time out interval in microseconds. The value must be in the range from 0 to 1000000000. The exception 'OutOfDomain' is raised if this range is violated.
Returns
True, if the event was signaled before the time-out interval expired.