"Matthew Shapiro" <kalldrexx / programmer.net> writes:

> keyboard input in a non-blocking way.  One thing that I have been
> thinking was using multithreading (which looks amazingly easy in
> ruby) and use the .collect() function, but does this block?  

As long as you use the IO functions from the IO class, ruby won't
block.

> Also will it pick up keys like the up arrow?

That depends on what the C library returns you. If your C library
allows you to pick up the up arrow key using getc, then ditto for
IO#getc.

Now, if my reading of eval.c and *sig* is correct, then the thread
granularity of ruby is per AST node, and if a node takes more than 500
ticks (of what?, of system's timer interrupt?), then it is pre-empted
except if Thread#critical is set.

Am I correct?

YS.