summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/thread.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/thread.rb b/lib/thread.rb
index 58c4f6b9e6..09f2d58ecc 100644
--- a/lib/thread.rb
+++ b/lib/thread.rb
@@ -185,7 +185,9 @@ class Queue
while true
if @que.empty?
raise ThreadError, "queue empty" if non_block
- @waiting.push Thread.current
+ # @waiting.include? check is necessary for avoiding a race against
+ # Thread.wakeup [Bug 5195]
+ @waiting.push Thread.current unless @waiting.include?(Thread.current)
@mutex.sleep
else
return @que.shift