Class epicsEvent

Class Documentation

class epicsEvent

A binary semaphore.

An epicsEvent is a binary semaphore that can be empty or full. When empty, a wait() issued before the next call to trigger() will block. When full, the next call to wait() will empty the event and return immediately. Multiple calls to trigger() may occur between wait() calls but will have the same effect as a single trigger(), filling the event.

Public Functions

epicsEvent(epicsEventInitialState initial = epicsEventEmpty)

Constructor.

Parameters

initial – State when created, empty (the default) or full.

~epicsEvent()

Destroy the epicsEvent and any resources it holds. No calls to wait() can be active when this call is made.

void trigger()

Trigger the event i.e. ensures the next or current call to wait completes. This method may be called from a vxWorks or RTEMS interrupt handler.

inline void signal()

Signal is a synonym for trigger().

void wait()

Wait for the event.

Note

Blocks until full.

bool wait(double timeout)

Wait for the event or until the specified timeout.

Parameters

timeout – The timeout delay in seconds. A timeout of zero is equivalent to calling tryWait(); NaN or any value too large to be represented to the target OS is equivalent to no timeout.

Returns

True if the event was triggered, False if it timed out.

bool tryWait()

Similar to wait() except that if the event is currently empty the call will return immediately.

Returns

True if the event was full (triggered), False if empty.

void show(unsigned level) const

Display information about the semaphore.

Note

The information displayed is architecture dependent.

Parameters

level – An unsigned int for the level of information to be displayed.