This patch updates comments in the Predicate class to describe a subtle behavior...
authorAndrew Kaylor <andrew.kaylor@intel.com>
Fri, 26 Oct 2012 19:28:36 +0000 (19:28 +0000)
committerAndrew Kaylor <andrew.kaylor@intel.com>
Fri, 26 Oct 2012 19:28:36 +0000 (19:28 +0000)
commit9ed6ae5ee0688bcc64bf632ee0c929e92d5c203f
treeb10bc156b9a4bf6375c8b1dc832330f4cf5c1de3
parentd7b30ef93cab9f58c35ed8c09572dc8defe7e02b
This patch updates comments in the Predicate class to describe a subtle behavior that callers may need to be aware.  It also adds documentation for one function which didn’t have any.

The subtle behavior is that the Predicate wait functions may not detect transitory changes in the predicate value.  Consider the following scenario.

Thread A waits for a bit to be set in the predicate value.
Thread B sets the bit in the predicate value.
Before Thread A wakes up, Thread C clears the bit in the predicate value.
Thread A wakes, checks the value and goes back to waiting.

The mutex and condition variables protect access to the value, but they offer no guarantee that another thread will not acquire the mutex and change the value before a waiting thread is restarted after a change.

I believe that the current behavior is correct and reasonable.  I just want to leave a marker to prevent possible problems in the future or to help anyone who might be unfortunate enough to encounter such a problem.

llvm-svn: 166800
lldb/include/lldb/Host/Predicate.h