From: "Michael W. Ryder" <_mwryder@...> Date: 2006-12-21T17:30:17+09:00 Subject: Re: Question regarding threads and I/O Michael W. Ryder wrote: > Robert Klemme wrote: >> On 18.12.2006 03:59, Michael W. Ryder wrote: >>> Logan Capaldo wrote: >>>> 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? >> >> You can use cygwin's Ruby - this works as expected for me on a Win XP >> Home (and I guess also Pro): >> >> Robert@Babelfish2 ~ >> $ uname -a >> CYGWIN_NT-5.1 Babelfish2 1.5.21(0.156/4/2) 2006-07-30 14:21 i686 Cygwin >> >> Robert@Babelfish2 ~ >> $ ruby -v >> ruby 1.8.5 (2006-08-25) [i386-cygwin] >> >> Robert@Babelfish2 ~ >> $ cat x.rb >> require 'timeout' >> foo = nil >> status = Timeout::timeout(5) { >> foo = gets() >> } >> puts (foo) >> >> >> Robert@Babelfish2 ~ >> $ ruby x.rb >> /usr/lib/ruby/1.8/timeout.rb:54: execution expired (Timeout::Error) >> from /usr/lib/ruby/1.8/timeout.rb:56:in `timeout' >> from x.rb:3 >> >> Robert@Babelfish2 ~ >> $ ruby x.rb >> 12345 >> 12345 >> >> I personally prefer cygwin on Windows boxes anyway because you have a >> nice shell, environment etc. >> >> Kind regards >> >> robert > > I just tried this on Cygwin using Ruby 1.8.4 and still have the same > problem I had with the Windows version. It still waits for I/O and > status is the same as the input. Neither is what I am looking for. I found out that Cygwin for some reason had not installed Ruby and was using the Windows version. I reinstalled Ruby and got the same output as Robert. Now I guess the next thing is to figure out how to catch the exception and figure out why status seems to have no meaning.