From 73ed28f1863d5ae3048a284e25a918255bdafe8a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 29 Apr 2011 18:11:04 +0000 Subject: xepoll_thread_spawn: fix race condition with acceptors Noticed under 1.8.7 --- lib/rainbows/xepoll_thread_spawn/client.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rainbows/xepoll_thread_spawn/client.rb b/lib/rainbows/xepoll_thread_spawn/client.rb index bb1f324..9735f64 100644 --- a/lib/rainbows/xepoll_thread_spawn/client.rb +++ b/lib/rainbows/xepoll_thread_spawn/client.rb @@ -8,6 +8,7 @@ module Rainbows::XEpollThreadSpawn::Client max = Rainbows.server.worker_connections ACCEPTORS = Rainbows::HttpServer::LISTENERS.map do |sock| Thread.new do + sleep begin if io = sock.kgio_accept(Rainbows::Client) N.incr(0, 1) @@ -39,6 +40,7 @@ module Rainbows::XEpollThreadSpawn::Client end def self.loop + ACCEPTORS.each { |thr| thr.run } begin EP.wait(nil, 1000) { |fl, obj| obj.epoll_run } expire -- cgit v1.2.3-24-ge0c7