Commit b5182c16 by Marcus Winter

base_cpp: added documentation for spurious wakeups with pthreads

parent b2491a2e
...@@ -99,6 +99,10 @@ class ConditionVariable { ...@@ -99,6 +99,10 @@ class ConditionVariable {
* \threadsafe * \threadsafe
* *
* \see NotifyOne(), NotifyAll() * \see NotifyOne(), NotifyAll()
*
* \note When Pthreads is used as the underlying library, this function may issue
* spurious wake ups to a waiting thread. Therefore it is recommended to
* use a loop checking the condition after a wakeup.
*/ */
void Wait( void Wait(
UniqueLock<Mutex>& lock UniqueLock<Mutex>& lock
...@@ -118,6 +122,10 @@ class ConditionVariable { ...@@ -118,6 +122,10 @@ class ConditionVariable {
* \throws embb::base::ErrorException if an error occurred * \throws embb::base::ErrorException if an error occurred
* *
* \threadsafe * \threadsafe
*
* \note When Pthreads is used as the underlying library, this function may issue
* spurious wake ups to a waiting thread. Therefore it is recommended to
* use a loop checking the condition after a wakeup.
*/ */
bool WaitUntil( bool WaitUntil(
UniqueLock<Mutex>& lock, UniqueLock<Mutex>& lock,
...@@ -141,6 +149,10 @@ class ConditionVariable { ...@@ -141,6 +149,10 @@ class ConditionVariable {
* \threadsafe * \threadsafe
* *
* \tparam Tick Type of tick of the duration. See Duration. * \tparam Tick Type of tick of the duration. See Duration.
*
* \note When Pthreads is used as the underlying library, this function may issue
* spurious wake ups to a waiting thread. Therefore it is recommended to
* use a loop checking the condition after a wakeup.
*/ */
template<typename Tick> template<typename Tick>
bool WaitFor( bool WaitFor(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment