about summary refs log tree commit homepage
path: root/lib/rainbows
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-04-21 21:21:13 +0000
committerEric Wong <normalperson@yhbt.net>2011-04-21 21:21:13 +0000
commit71d48a01a7c257dffa22c10781c55deff64037d2 (patch)
tree7b1d12ceb6d1652816195d0bd983e06ef2615fcb /lib/rainbows
parent7f368d2cf9e456e37f1489dc275ed0de007175dd (diff)
downloadrainbows-71d48a01a7c257dffa22c10781c55deff64037d2.tar.gz
Should be fixed in 1.9.3 and/or future Kgio...
Diffstat (limited to 'lib/rainbows')
-rw-r--r--lib/rainbows/join_threads.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/rainbows/join_threads.rb b/lib/rainbows/join_threads.rb
index ba67c94..5d5c64f 100644
--- a/lib/rainbows/join_threads.rb
+++ b/lib/rainbows/join_threads.rb
@@ -5,9 +5,13 @@ module Rainbows::JoinThreads
 
   # blocking acceptor threads must be forced to run
   def self.acceptors(threads)
+    expire = Time.now + Rainbows.server.timeout
     threads.delete_if do |thr|
       Rainbows.tick
       begin
+        # blocking accept() may not wake up properly
+        thr.raise(Errno::EINTR) if Time.now > expire && "sleep" == thr.status
+
         thr.run
         thr.join(0.01)
       rescue