------art_26026_29096075.1199459699490
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Jan 4, 2008 10:01 AM, James Tucker <jftucker / gmail.com> wrote:

> STDIN.gets blocks hard on windows - that is, it blocks at the "c
> level" which blocks all running green threads.
>
> The result is this 'lag' behavior - in fact what is happening normally
> is that you're not getting any running threads or socket reads except
> in the time between gets returning a value, and being called again.
>
> If you avoid $stdin, you will find that the flow is smooth.
>
> Oh, and $stdout blocks too...
>
> There's a video here that sort of demonstrates this in a visual way:
>
> http://blog.ra66i.org/wp-content/network_rotator_fun.swf
>
> One side is an echo server, which reverses the string it echos, and
> the other is a generator, which generates strings with a moving # in
> them. "I" and "O" have meaning local to the respective application.
> The right hand side is the generator, the left hand side is the
> reversing echo server.
>
> Those were actually built on top of EM, but it's the same issue you see.
>
>

The generic answer that EM would provide is: "don't use threads at all."
Unfortunately, at the current time, there is a problem in EM's console
handler that makes event-driven keyboard input unreliable on Windows. We
ought to solve this problem asap.

------art_26026_29096075.1199459699490--