From: Joel VanderWerf Date: 2006-12-18T11:19:22+09:00 Subject: Re: Question regarding threads and I/O Michael W. Ryder wrote: > Maybe I am missing something here but it doesn't seem to work for me. I > have the following simple program: > > require 'timeout' > foo = nil > status = Timeout::timeout(5) { > foo = gets() > } > puts (foo) > > If I enter something, say 123, then the program displays the 123 as > expected. If I just wait it sits there until I enter something which is > not what I want. I want the input to terminate and display that foo is > 'nil'. For some reason testing the value of status shows that it is the > same as the input, but this may not be relevant to the problem. That's a problem with the combination of the msvc-based ruby on windows and gets and threads (Timeout uses a thread). There was a discussion in the ruby-talk list with subject "Thread and sleep" a few days ago. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407