lib/rainbows/xepoll_thread_pool/client.rb in rainbows-3.3.0 vs lib/rainbows/xepoll_thread_pool/client.rb in rainbows-3.4.0

- old
+ new

@@ -35,15 +35,19 @@ QUEUE = Queue.new Rainbows::O[:pool_size].times { Thread.new { app_run(QUEUE) } } ep = SleepyPenguin::Epoll EP = ep.new - Rainbows.at_quit { EP.close } IN = ep::IN | ep::ET | ep::ONESHOT KATO = {} KATO.compare_by_identity if KATO.respond_to?(:compare_by_identity) LOCK = Mutex.new + Rainbows.at_quit do + clients = nil + LOCK.synchronize { clients = KATO.keys; KATO.clear } + clients.each { |io| io.closed? or io.close } + end @@last_expire = Time.now def kato_set LOCK.synchronize { KATO[self] = @@last_expire } EP.set(self, IN) @@ -121,9 +125,9 @@ end def pipeline_ready(hp) # be fair to other clients, let others run first hp.parse and return queue! - kato_set + epoll_run("") false end end