coolio+xepoll_thread*: use shutdown() for keepalive timeout
authorEric Wong <normalperson@yhbt.net>
Sat, 30 Jun 2012 19:57:08 +0000 (19:57 +0000)
committerEric Wong <normalperson@yhbt.net>
Sun, 1 Jul 2012 01:14:46 +0000 (01:14 +0000)
commit36ce10c49ce7aa0df9d47f5a5f870c23c1891258
treee294b2af13568f21172b2286d7e0af5372bcbbcf
parenta5b987619f4b793203f6a50e424fe98c5b0794ba
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/coolio/client.rb
lib/rainbows/xepoll_thread_pool/client.rb
lib/rainbows/xepoll_thread_spawn/client.rb