On Thu, 26 Feb 2004 nobu.nokada / softhome.net wrote:

> Hi,
> 
> At Thu, 26 Feb 2004 09:04:47 +0900,
> Ara.T.Howard wrote in [ruby-talk:93709]:
> > following is a _simulation_ of a rather complex gui i'm working on.  the gui
> > run a procedure which, itself, is communication with many other processes via
> > Open3::popen3 (i _need_ the stderr)... anyhow, i'm having fits getting the gui
> > to update and do all the io (select/read, etc).  this code seems to work fine
> > but i am very conerned that something might bite me later... if anyone would
> > care to comment on the interactions between the io and threads and if this is
> > a reccomended approach i'd love to hear it... remember this code might look a
> > bit funny but it demonstrative of what my code actually does.  thanks in
> > advance for any help/advice
> 

> In [ruby-dev:22861], Akira Tanaka supposed use of sysread instead of
> non-blocking mode.

wow.  tried babelfish but i'm a bit lost on that one ;-)

what is a 'bean jam ball'? sounds like something good...

i tried replacing with sysread but am now failing with

  sysread for buffered IO (IOError)

....

for now i seem to be having luck with (this is after a select because i am
multiplexing stdout and stderr from another process)

  text = ''
  sleep(0.042) and Thread.pass until rio.ready?
  text << rio.getc while rio.ready?
  label.configure :text=>text

but reading only a character at a time when the io object is ready i hope to
never block.  this is what i had hoped to accomplish by

  io.nonblock{ io.read }

but this does seem to work fine - i don't really know how to say 'read
everything that is available but do not block' from within a multi-threaded
application...

> # As for blocking on non-blocking IO, I'll investigate later.

thanks.  i'd be quite interested to hear what you find.

-a
-- 
===============================================================================
| EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE   :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL     :: http://www.ngdc.noaa.gov/stp/
| TRY     :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done 
===============================================================================