Bug 1536316 remove suggestion that spurious condition variable wakeups are magically handled by ConditionVariableImpl r=froydnj
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 25 Mar 2019 12:41:19 +0000
changeset 465997 9fa7ed12ba262d47c6d565887d25387775815dc9
parent 465996 6268d2aa99da8121c5e688fb08792eef51bafab4
child 465998 fef0ddcd6bbaa0b8bbbaabcea3f59db3d4be1f90
push id35758
push userrgurzau@mozilla.com
push dateTue, 26 Mar 2019 09:51:47 +0000
treeherdermozilla-central@4572f6055a6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1536316
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1536316 remove suggestion that spurious condition variable wakeups are magically handled by ConditionVariableImpl r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D23983
mozglue/misc/PlatformConditionVariable.h
--- a/mozglue/misc/PlatformConditionVariable.h
+++ b/mozglue/misc/PlatformConditionVariable.h
@@ -31,18 +31,22 @@ class ConditionVariableImpl {
   MFBT_API ~ConditionVariableImpl();
 
   // Wake one thread that is waiting on this condition.
   MFBT_API void notify_one();
 
   // Wake all threads that are waiting on this condition.
   MFBT_API void notify_all();
 
-  // Block the current thread of execution until this condition variable is
-  // woken from another thread via notify_one or notify_all.
+  // Atomically release |lock| and sleep the current thread of execution on
+  // this condition variable.
+  // |lock| will be re-acquired before this function returns.
+  // The thread may be woken from sleep from another thread via notify_one()
+  // or notify_all(), but may also wake spuriously.  The caller should recheck
+  // its predicate after this function returns, typically in a while loop.
   MFBT_API void wait(MutexImpl& lock);
 
   MFBT_API CVStatus wait_for(MutexImpl& lock,
                              const mozilla::TimeDuration& rel_time);
 
  private:
   ConditionVariableImpl(const ConditionVariableImpl&) = delete;
   ConditionVariableImpl& operator=(const ConditionVariableImpl&) = delete;