diff --git a/base_c/include/embb/base/c/condition_variable.h b/base_c/include/embb/base/c/condition_variable.h index d707c2b..9d247b5 100644 --- a/base_c/include/embb/base/c/condition_variable.h +++ b/base_c/include/embb/base/c/condition_variable.h @@ -110,6 +110,9 @@ int embb_condition_notify_all( * \threadsafe * \see embb_condition_notify_one(), embb_condition_notify_all(), * embb_condition_wait_until(), embb_condition_wait_for() + * \note It is strongly recommended checking the condition in a loop in order + * to deal with spurious wakeups and situations where another thread has + * locked the mutex between notification and wakeup. */ int embb_condition_wait( embb_condition_t* condition_var, @@ -131,6 +134,9 @@ int embb_condition_wait( * \threadsafe * \see embb_condition_notify_one(), embb_condition_notify_all(), * embb_condition_wait(), embb_condition_wait_for() + * \note It is strongly recommended checking the condition in a loop in order + * to deal with spurious wakeups and situations where another thread has + * locked the mutex between notification and wakeup. */ int embb_condition_wait_until( embb_condition_t* condition_var, @@ -154,6 +160,9 @@ int embb_condition_wait_until( * \threadsafe * \see embb_condition_notify_one(), embb_condition_notify_all(), * embb_condition_wait(), embb_condition_wait_until() + * \note It is strongly recommended checking the condition in a loop in order + * to deal with spurious wakeups and situations where another thread has + * locked the mutex between notification and wakeup. */ int embb_condition_wait_for( embb_condition_t* condition_var, diff --git a/base_cpp/include/embb/base/condition_variable.h b/base_cpp/include/embb/base/condition_variable.h index 50dd37a..42e6c20 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 It is strongly recommended checking the condition in a loop in order + * to deal with spurious wakeups and situations where another thread has + * locked the mutex between notification and wakeup. */ void Wait( UniqueLock& lock @@ -118,6 +122,10 @@ class ConditionVariable { * \throws embb::base::ErrorException if an error occurred * * \threadsafe + * + * \note It is strongly recommended checking the condition in a loop in order + * to deal with spurious wakeups and situations where another thread has + * locked the mutex between notification and wakeup. */ bool WaitUntil( UniqueLock& lock, @@ -141,6 +149,10 @@ class ConditionVariable { * \threadsafe * * \tparam Tick Type of tick of the duration. See Duration. + * + * \note It is strongly recommended checking the condition in a loop in order + * to deal with spurious wakeups and situations where another thread has + * locked the mutex between notification and wakeup. */ template bool WaitFor(