Embedded Multicore Building Blocks V1.0.0
|
Represents a condition variable for thread synchronization. More...
#include <condition_variable.h>
Public Member Functions | |
ConditionVariable () | |
Creates a condition variable. More... | |
void | NotifyOne () |
Wakes up one waiting thread. More... | |
void | NotifyAll () |
Wakes up all waiting threads. More... | |
void | Wait (UniqueLock< Mutex > &lock) |
Releases the lock and waits until the thread is woken up. More... | |
bool | WaitUntil (UniqueLock< Mutex > &lock, const Time &time) |
Releases the lock and waits until the thread is woken up or the specified time point has passed. More... | |
template<typename Tick > | |
bool | WaitFor (UniqueLock< Mutex > &lock, const Duration< Tick > &duration) |
Releases the lock and waits until the thread is woken up or the specified duration has passed. More... | |
Represents a condition variable for thread synchronization.
Provides an abstraction from platform-specific condition variable implementations. Condition variables can be waited for with timeouts using relative durations and absolute time points.
This class is essentially a wrapper for the underlying C implementation.
embb::base::ConditionVariable::ConditionVariable | ( | ) |
Creates a condition variable.
embb::base::ErrorException | if initialization failed |
void embb::base::ConditionVariable::NotifyOne | ( | ) |
Wakes up one waiting thread.
embb::base::ErrorException | if notification failed |
void embb::base::ConditionVariable::NotifyAll | ( | ) |
Wakes up all waiting threads.
embb::base::ErrorException | if notification failed |
void embb::base::ConditionVariable::Wait | ( | UniqueLock< Mutex > & | lock | ) |
Releases the lock and waits until the thread is woken up.
embb::base::ErrorException | if waiting failed |
[in,out] | lock | Lock to be released and re-acquired |
bool embb::base::ConditionVariable::WaitUntil | ( | UniqueLock< Mutex > & | lock, |
const Time & | time | ||
) |
Releases the lock and waits until the thread is woken up or the specified time point has passed.
true
if the thread was woken up before the specified time point has passed, otherwise false
.embb::base::ErrorException | if an error occurred |
[in,out] | lock | Lock to be released and re-acquired |
[in] | time | Absolute time point until which the thread maximally waits |
bool embb::base::ConditionVariable::WaitFor | ( | UniqueLock< Mutex > & | lock, |
const Duration< Tick > & | duration | ||
) |
Releases the lock and waits until the thread is woken up or the specified duration has passed.
true
if the thread was woken up before the specified duration has passed, otherwise false
.embb::base::ErrorException | if an error occurred |
Tick | Type of tick of the duration. See Duration. |
[in,out] | lock | Lock to be released and re-acquired |
[in] | duration | Relative time duration the thread maximally waits |