diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-04 07:40:58 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-04 07:44:47 +0000 |
commit | e867a6d1a612baf7975b14f9bffa14ea8b05f35c (patch) | |
tree | daa1c2060286c7ae22232ee3ee2d2e472ed7f8d1 /lib/rainbows | |
parent | 7e3de7a12629423e911dae8955e7cc2035d6c401 (diff) | |
download | rainbows-e867a6d1a612baf7975b14f9bffa14ea8b05f35c.tar.gz |
We may use a blocking accept() loop if there is only a single listener. In that case threads may not be able to exit if a SIGQUIT is received, so force them to run when joining.
Diffstat (limited to 'lib/rainbows')
-rw-r--r-- | lib/rainbows/thread_pool.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/rainbows/thread_pool.rb b/lib/rainbows/thread_pool.rb index 6fce3c1..f609483 100644 --- a/lib/rainbows/thread_pool.rb +++ b/lib/rainbows/thread_pool.rb @@ -70,7 +70,12 @@ module Rainbows G.quit! threads.delete_if do |thr| G.tick - thr.alive? ? thr.join(0.01) : true + begin + thr.run + thr.join(0.01) + rescue + true + end end until threads.empty? end |