From: "Michael W. Ryder" <_mwryder@...> Date: 2006-12-18T12:00:06+09:00 Subject: Re: Question regarding threads and I/O Logan Capaldo wrote: > On Mon, Dec 18, 2006 at 10:40:05AM +0900, 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. > It works for me (well actually timeout throws an exception when the time > runs out, doesn't just baort gracefully, but that's what it's supposed > to do.) > > What platform are you on? > Windows XP Pro, which I guess is part of the problem. The problem I have with Ruby is that I know it is possible to get this to work in other languages, BBX (Business Basic) for example. It may be that because BBX did not use Microsoft compilers, it has been out longer than Microsoft has existed, that it doesn't have some limitations built into the Microsoft compilers. This of course raises the question is there a free compiler, such as gcc, which could compile Ruby without the thread lock problem?