about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-11 01:37:20 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-11 01:37:20 -0700
commit427ac38fe3eeadad1d6fb897bd835607a9372aad (patch)
tree5c1485d3853541424d0ef00680034dbe98d79949
parent178812e24edc3c912f7c2c13b37ab7f9e41d243c (diff)
downloadrainbows-427ac38fe3eeadad1d6fb897bd835607a9372aad.tar.gz
Avoid potential race conditions with signal handlers, this makes
exits cleaner since the LISTENERS array will get map!-ed to nils
in the :QUIT signal handler.
-rw-r--r--lib/rainbows/thread_pool.rb2
-rw-r--r--lib/rainbows/thread_spawn.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/rainbows/thread_pool.rb b/lib/rainbows/thread_pool.rb
index 9f1a8db..766742e 100644
--- a/lib/rainbows/thread_pool.rb
+++ b/lib/rainbows/thread_pool.rb
@@ -71,7 +71,7 @@ module Rainbows
             IO.select(LISTENERS, nil, nil, timeout/2.0) or next
           rescue Errno::EINTR
             retry
-          rescue Errno::EBADF
+          rescue Errno::EBADF, TypeError
             return
           end
           ret.first.each do |sock|
diff --git a/lib/rainbows/thread_spawn.rb b/lib/rainbows/thread_spawn.rb
index f1acf07..32040ad 100644
--- a/lib/rainbows/thread_spawn.rb
+++ b/lib/rainbows/thread_spawn.rb
@@ -32,7 +32,7 @@ module Rainbows
           IO.select(LISTENERS, nil, nil, timeout/2.0) or next
         rescue Errno::EINTR
           retry
-        rescue Errno::EBADF
+        rescue Errno::EBADF, TypeError
           break
         end