From b5182c16dcfb63aa40530e96436feaf21c1f114f Mon Sep 17 00:00:00 2001 From: Marcus Winter Date: Mon, 20 Jun 2016 14:42:29 +0200 Subject: [PATCH] base_cpp: added documentation for spurious wakeups with pthreads --- base_cpp/include/embb/base/condition_variable.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/base_cpp/include/embb/base/condition_variable.h b/base_cpp/include/embb/base/condition_variable.h index 50dd37a..5e535f2 100644 --- a/base_cpp/include/embb/base/condition_variable.h +++ b/base_cpp/include/embb/base/condition_variable.h @@ -99,6 +99,10 @@ class ConditionVariable { * \threadsafe * * \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( UniqueLock& lock @@ -118,6 +122,10 @@ class ConditionVariable { * \throws embb::base::ErrorException if an error occurred * * \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( UniqueLock& lock, @@ -141,6 +149,10 @@ class ConditionVariable { * \threadsafe * * \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 bool WaitFor( -- libgit2 0.26.0