YARP  2.3.70.2
Yet Another Robot Platform
yarp::os::Event Class Reference

A class for thread synchronization and mutual exclusion. More...

#include <yarp/os/Event.h>

Public Member Functions

 Event (bool autoResetAfterWait=true)
 Constructor. More...
 
virtual ~Event ()
 Destructor. More...
 
void wait ()
 Wait for the event to be signaled. More...
 
void signal ()
 Put the event in a signaled state. More...
 
void reset ()
 Put the event in a reset state. More...
 

Private Attributes

void * implementation
 

Detailed Description

A class for thread synchronization and mutual exclusion.

An event can be in a signaled or reset state. Threads can wait for an event to enter a signaled state.

Definition at line 26 of file Event.h.

Constructor & Destructor Documentation

◆ Event()

yarp::os::Event::Event ( bool  autoResetAfterWait = true)

Constructor.

Sets the initial value of the counter.

Parameters
autoResetAfterWaitif set, reset() will be called automatically after wait().

Definition at line 84 of file Event.cpp.

◆ ~Event()

yarp::os::Event::~Event ( )
virtual

Destructor.

Definition at line 92 of file Event.cpp.

Member Function Documentation

◆ reset()

void yarp::os::Event::reset ( )

Put the event in a reset state.

Definition at line 107 of file Event.cpp.

◆ signal()

void yarp::os::Event::signal ( )

Put the event in a signaled state.

A thread wait()ing for the event will wake up. If the event was created with autoResetAfterWait set, then at most one thread will wake up (and then automatically reset the event), otherwise all waiting threads will wake up.

Definition at line 103 of file Event.cpp.

◆ wait()

void yarp::os::Event::wait ( )

Wait for the event to be signaled.

If the event was created with autoResetAfterWait set, then after a wait the event will automatically be reset. That means that any other thread waiting for the same event will not be woken up by the signal that wakes up this call to wait().

Definition at line 99 of file Event.cpp.

Member Data Documentation

◆ implementation

void* yarp::os::Event::implementation
private

Definition at line 71 of file Event.h.


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