From: Charles Oliver Nutter Date: 2008-10-17T06:33:00+09:00 Subject: [ruby-core:19361] Re: timeout use in protocol.rb....why? Dave Thomas wrote: > > On Oct 16, 2008, at 2:14 PM, Charles Oliver Nutter wrote: > >> >> def rbuf_fill >> if select([@io], nil, nil, @read_timeout) >> @rbuf << @io.sysread(1024*16) >> else >> raise Timeout::Error >> end >> end >> >> ...or something similar? I've tested something like that and it >> appears to work fine, plus it spins up no threads and does not require >> Thread#kill/raise. > > Might it be a portability issue with Windows and select? if (WINDOWS) ... ...and if it's an issue with it actually being a socket, you could check for that too. Seems like the benefit of getting rid of thread churn (and the corresponding drop in performance related when threads come into existence) would be worth it. - Charlie