From 71d48a01a7c257dffa22c10781c55deff64037d2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 21 Apr 2011 21:21:13 +0000 Subject: join_threads: workaround blocking accept() issues Should be fixed in 1.9.3 and/or future Kgio... --- lib/rainbows/join_threads.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/rainbows/join_threads.rb') 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 -- cgit v1.2.3-24-ge0c7