From: Francis Cianfrocca Date: 2006-11-01T16:23:47+09:00 Subject: Re: Nonblocking IO read ------=_Part_11029_3682595.1162365824977 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 11/1/06, ara.t.howard@noaa.gov wrote: > > > now, timeout might use any manner of select and/or nbio - i don't > care. my > point is just that, for 90-99% of the problems seem to want to solve with > nbio, it is way too low level a mechanism to skin the cat and prefer to > stand > on the shoulders of powerful abstractions, like eventmachine or threads or > whatever, and avoid the painful details of EAGAIN, race conditions (it > wasn't > ready so i... oops, now it is ready), and stdio buffers being lost. > > for the record, i have code which uses nbio, io/nonblock, etc. it's > simply my > observation that a majority of the posts to this list about nbio have two > issues: > > - nothing else can really be done while waiting for io. eg. nbio > isn't > needed for the problem at hand > > - something else could simoultaneously be done, but the problem could > be > more elegantly solved with threads, queues, readpartial, or something > even > more abstract > > the rest, of course, really do need nbio. a quick search of archives > though > is an eye opener into the difficulties of mixing nbio and stdio, check out > these threads, specifically the posts by tanaka akira, who knows about 10 > billion times more about nbio and ruby than i do > > > http://groups-beta.google.com/group/comp.lang.ruby/browse_frm/thread/47b0e296cbe9c410/23e22cc9e56a3200?lnk=gst&q=non+blocking+io&rnum=1#23e22cc9e56a3200 > > > http://groups-beta.google.com/group/comp.lang.ruby/browse_frm/thread/116231c43621a61b/775af5d9900aa716?lnk=gst&q=non+blocking+io&rnum=6#775af5d9900aa716 > > > http://groups-beta.google.com/group/comp.lang.ruby/browse_frm/thread/116231c43621a61b/775af5d9900aa716?lnk=gst&q=non+blocking+io&rnum=6#775af5d9900aa716 > > > http://groups-beta.google.com/group/comp.lang.ruby/browse_frm/thread/116231c43621a61b/775af5d9900aa716?lnk=gst&q=non+blocking+io&rnum=6#775af5d9900aa716 > > > his insight is enough to raise 'too low-level' warnings in my mind! at > least > until using nbio from a ruby script doesn't require such deep > understanding of > ruby's internals Thanks for clarifying, Ara. Having put a lot of work into domesticating nbio for Ruby programs, all I can say is I agree with you. I still don't feel like I understand what the OP really is trying to do. Feels like it shouldn't be such a hard problem. Maybe nbio is just a red herring in this case (although it does appear in the first sentence of the OP). ------=_Part_11029_3682595.1162365824977--