> One option is use Kernel.select, or, equivalently, IO.select.
> 
> Basically, select waits for input on some ios.  But it allows for a
> timeout value which I believe can be 0.

I tried this, but no luck.  The command works, but it's the same 
problem... every thread is suspended until it returns.

> Another option is to use fcntl with F_SETFL and O_NONBLOCK.
> 
> e.g.:
> 
> requite 'fcntl'
> STDIN.fcntl(Fcntl::F_SETFL,Fcntl::O_NONBLOCK)
> STDIN.read
> 
> Will throw an Errno:EAGAIN if there is no input.

Hmm.  I might try this if nothing else works, but that's going to be a 
lot of wasted clock cycles.  Ideally, the thread would just sleep until 
STDIN has something in it.  Is there no way to accomplish that?

-- 
Posted via http://www.ruby-forum.com/.