A platform independent wait condition implementation. More...
#include <xsens_mutex.h>
Public Member Functions | |
void | broadcast () |
Unblock all waiting threads. More... | |
void | signal () |
Unblock a single waiting thread. More... | |
bool | wait () |
Wait until we're signalled to continue. More... | |
bool | wait (uint32_t timeout) |
Wait until we're signalled to continue, or until timeout [ms] has passed. More... | |
WaitCondition (Mutex &m) | |
Create a wait condition. More... | |
~WaitCondition () | |
Destroy the wait condition. More... | |
Private Member Functions | |
WaitCondition & | operator= (WaitCondition &&)=delete |
WaitCondition & | operator= (WaitCondition const &)=delete |
WaitCondition (WaitCondition &&)=delete | |
WaitCondition (WaitCondition const &)=delete | |
Private Attributes | |
clockid_t | m_clockId |
pthread_cond_t | m_cond |
pthread_condattr_t | m_condattr |
Mutex & | m_mutex |
A platform independent wait condition implementation.
Wait conditions are used to halt consumer threads until changes are made to data they operate on.
Creating the wait condition:
Consumer thread:
Feeder thread:
Definition at line 1806 of file xsens_mutex.h.
|
privatedelete |
|
privatedelete |
|
explicit |
Create a wait condition.
Definition at line 929 of file threading.cpp.
xsens::WaitCondition::~WaitCondition | ( | ) |
Destroy the wait condition.
Definition at line 951 of file threading.cpp.
void xsens::WaitCondition::broadcast | ( | ) |
Unblock all waiting threads.
Definition at line 977 of file threading.cpp.
|
privatedelete |
|
privatedelete |
void xsens::WaitCondition::signal | ( | ) |
Unblock a single waiting thread.
Definition at line 967 of file threading.cpp.
bool xsens::WaitCondition::wait | ( | ) |
Wait until we're signalled to continue.
\details Before calling this function, it is required that the mutex provided during construction is _locked_. This function unlocks the mutex internally, and returns with the mutex locked again. \return true if we were signalled, false otherwise
Definition at line 994 of file threading.cpp.
bool xsens::WaitCondition::wait | ( | uint32_t | timeout | ) |
Wait until we're signalled to continue, or until timeout [ms] has passed.
\details Before calling this function, it is required that the mutex provided during construction is _locked_. This function unlocks the mutex internally, and returns with the mutex locked again. \param timeout The timeout value in ms \return true if we were signalled, false otherwise
Definition at line 1013 of file threading.cpp.
|
private |
Definition at line 1830 of file xsens_mutex.h.
|
private |
Definition at line 1825 of file xsens_mutex.h.
|
private |
Definition at line 1826 of file xsens_mutex.h.
|
private |
Definition at line 1833 of file xsens_mutex.h.