Public Member Functions | Private Member Functions | Private Attributes | List of all members
xsens::WaitEvent Class Reference

An event that can be set/reset and that can be waited for. More...

#include <xsens_mutex.h>

Public Member Functions

void reset ()
 Reset the event. More...
 
void set ()
 Set the event. More...
 
void terminate ()
 Terminates the thread. More...
 
bool wait ()
 Wait for the event to be set or object termination. More...
 
 WaitEvent ()
 
 ~WaitEvent ()
 

Private Member Functions

WaitEventoperator= (WaitEvent &&)=delete
 
WaitEventoperator= (WaitEvent const &)=delete
 
 WaitEvent (WaitEvent &&)=delete
 
 WaitEvent (WaitEvent const &)=delete
 

Private Attributes

pthread_cond_t m_cond
 
pthread_mutex_t m_mutex
 
volatile std::atomic_bool m_terminating
 
bool m_triggered
 
volatile std::atomic_int m_waiterCount
 

Detailed Description

An event that can be set/reset and that can be waited for.

The WaitEvent is intended for 1-1 thread synchronization, not 1-N thread synchronization

Definition at line 1839 of file xsens_mutex.h.

Constructor & Destructor Documentation

◆ WaitEvent() [1/3]

xsens::WaitEvent::WaitEvent ( WaitEvent const &  )
privatedelete

◆ WaitEvent() [2/3]

xsens::WaitEvent::WaitEvent ( WaitEvent &&  )
privatedelete

◆ WaitEvent() [3/3]

xsens::WaitEvent::WaitEvent ( )

Definition at line 1100 of file threading.cpp.

◆ ~WaitEvent()

xsens::WaitEvent::~WaitEvent ( )

Definition at line 1109 of file threading.cpp.

Member Function Documentation

◆ operator=() [1/2]

WaitEvent& xsens::WaitEvent::operator= ( WaitEvent &&  )
privatedelete

◆ operator=() [2/2]

WaitEvent& xsens::WaitEvent::operator= ( WaitEvent const &  )
privatedelete

◆ reset()

void xsens::WaitEvent::reset ( )

Reset the event.

Any wait() call will block until set() or terminate() is called.

Note
After terminate() has been called, reset() will not reset the event anymore

Definition at line 1148 of file threading.cpp.

◆ set()

void xsens::WaitEvent::set ( )

Set the event.

Waiting items will (all) be notified and allowed to run

Definition at line 1136 of file threading.cpp.

◆ terminate()

void xsens::WaitEvent::terminate ( )

Terminates the thread.

Definition at line 1162 of file threading.cpp.

◆ wait()

bool xsens::WaitEvent::wait ( )

Wait for the event to be set or object termination.

Returns
true if the event is set and the object is not being terminated

Definition at line 1119 of file threading.cpp.

Member Data Documentation

◆ m_cond

pthread_cond_t xsens::WaitEvent::m_cond
private

Definition at line 1860 of file xsens_mutex.h.

◆ m_mutex

pthread_mutex_t xsens::WaitEvent::m_mutex
private

Definition at line 1859 of file xsens_mutex.h.

◆ m_terminating

volatile std::atomic_bool xsens::WaitEvent::m_terminating
private

Definition at line 1864 of file xsens_mutex.h.

◆ m_triggered

bool xsens::WaitEvent::m_triggered
private

Definition at line 1861 of file xsens_mutex.h.

◆ m_waiterCount

volatile std::atomic_int xsens::WaitEvent::m_waiterCount
private

Definition at line 1863 of file xsens_mutex.h.


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


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:23