From 36ce10c49ce7aa0df9d47f5a5f870c23c1891258 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 30 Jun 2012 19:57:08 +0000 Subject: coolio+xepoll_thread*: use shutdown() for keepalive timeout Triggering Errno::EBADF is tricky in multithreaded situations due to possible race conditions and yet-to-be discovered bugs. shutdown(2) is also safe against apps the fork() internally but do not execve(2) nor set FD_CLOEXEC. n.b. calling fork() after pthreads are spawned may not be safe on all platforms w.r.t. malloc, but /is/ the case for glibc on GNU/Linux. Follow-up-to: commit a5b987619f4b793203f6a50e424fe98c5b0794ba --- lib/rainbows/xepoll_thread_spawn/client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/rainbows/xepoll_thread_spawn/client.rb') diff --git a/lib/rainbows/xepoll_thread_spawn/client.rb b/lib/rainbows/xepoll_thread_spawn/client.rb index 1d3a280..6c07b92 100644 --- a/lib/rainbows/xepoll_thread_spawn/client.rb +++ b/lib/rainbows/xepoll_thread_spawn/client.rb @@ -33,7 +33,7 @@ module Rainbows::XEpollThreadSpawn::Client Rainbows.at_quit do clients = nil LOCK.synchronize { clients = KATO.keys; KATO.clear } - clients.each { |io| io.closed? or io.close } + clients.each { |io| io.closed? or io.shutdown } end @@last_expire = Time.now -- cgit v1.2.3-24-ge0c7