diff --git a/CHANGES b/CHANGES index 10bc187666..1ae192f293 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ +2.2-beta-152 | 2013-10-24 18:16:49 -0700 + + * Fix for input readers occasionally dead-locking. (Robin Sommer) + 2.2-beta-151 | 2013-10-24 16:52:26 -0700 * Updating submodule(s). diff --git a/VERSION b/VERSION index 2b5702fffa..26d1beb6fe 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2-beta-151 +2.2-beta-152 diff --git a/src/threading/Queue.h b/src/threading/Queue.h index 792fb63f9c..c4f2bfab00 100644 --- a/src/threading/Queue.h +++ b/src/threading/Queue.h @@ -61,11 +61,13 @@ public: bool Ready(); /** - * Returns true if the next Get() operation might succeed. - * This function may occasionally return a value not - * indicating the actual state, but won't do so very often. + * Returns true if the next Get() operation might succeed. This + * function may occasionally return a value not indicating the actual + * state, but won't do so very often. Occasionally we also return a + * true unconditionally to avoid a deadlock when both pointers happen + * to be equal even though there's stuff queued. */ - bool MaybeReady() { return ( ( read_ptr - write_ptr) != 0 ); } + bool MaybeReady() { return (read_ptr != write_ptr) || (random() % 10000 == 0); } /** Wake up the reader if it's currently blocked for input. This is primarily to give it a chance to check termination quickly.