From efe6bd4082ea588cc115f1d919c1f30a6bf9ea7a Mon Sep 17 00:00:00 2001 From: raggi Date: Fri, 5 Jun 2009 17:01:20 +0100 Subject: [PATCH] Support 1.9 in threadpool killing --- lib/eventmachine.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/eventmachine.rb b/lib/eventmachine.rb index 8211be3d0..7332b7220 100644 --- a/lib/eventmachine.rb +++ b/lib/eventmachine.rb @@ -246,7 +246,11 @@ def self.run blk=nil, tail=nil, &block ensure if @threadpool @threadpool.each { |t| t.exit } - @threadpool.each { |t| t.kill! if t.alive? } + @threadpool.each do |t| + next unless t.alive? + # ruby 1.9 has no kill! + t.respond_to?(:kill!) ? t.kill! : t.kill + end @threadqueue = nil @resultqueue = nil end