summaryrefslogtreecommitdiff
path: root/lib/thread.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/thread.rb')
-rw-r--r--lib/thread.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/thread.rb b/lib/thread.rb
index 20ce6aef5d..a0e6967a28 100644
--- a/lib/thread.rb
+++ b/lib/thread.rb
@@ -157,8 +157,10 @@ class Queue
t.wakeup if t
rescue ThreadError
retry
+ ensure
+ Thread.critical = false
end
- Thread.critical = false
+ t.run if t
end
alias enq push
@@ -250,10 +252,13 @@ class SizedQueue<Queue
if @que.length < @max
begin
t = @queue_wait.shift
- t.run if t
+ t.wakeup if t
rescue ThreadError
retry
+ ensure
+ Thread.critical = false
end
+ t.run if t
end
super
end