------ art_178932_8457812.1148172866896 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Ahh, thanks for pointing it out, although it ain't the answer I was hoping for. Interesting that your concern (not having to think about EAGAIN) is opposite from mine- I'm *wanting* to get EAGAIN so I can do something else while waiting for the I/O. Solved my problem by holding my nose and writing an IO#read_nonblocking method in C. On 5/20/06, Bill Kelly <billk / cts.com> wrote: > > From: "Francis Cianfrocca" <garbagecat10 / gmail.com> > > > > What am I missing here? > > > > require 'socket' > > require 'fcntl' > > Thread.new {sleep 100} > > sd = TCPsocket.new( "www.cisco.com", 80) > > m = sd.fcntl( Fcntl::F_GETFL, 0) > > sd.fcntl( Fcntl::F_SETFL, Fcntl::O_NONBLOCK | m) > > sd.sysread(4096) > > > > This code blocks in the sysread, in effect ignoring the nonblocking mode > set > > on the file descriptor. But if you comment out the line that spins the > > thread, the sysread raises Errno::EAGAIN as you'd expect. > > > > Is this a defined behavior or a bug? > > Hi, I learned about this just the other day. See thread > starting here: > > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/192008 > > > Regards, > > Bill > > > > ------ art_178932_8457812.1148172866896--