On 2/12/06, Timothy Goddard <interfecus / gmail.com> wrote:
> As a method without having to worry about threads you could also use:
>
> require 'timeout'
>
> messages = ["What are you waiting for?", "I don't have all day.", "When
> I said 'take your time', I didn't mean this long!", "Hurry up and enter
> a value!"]
>
> s = nil
> until s
>   begin
>     Timeout::timeout(5) do
>       puts "Enter a value: "
>       s = gets
>     end
>   rescue Timeout::Error
>     puts messages[rand(messages.length).to_i]
>   end
> end

I thought this was a good example, so I tried running your code. It
doesn't work using the latest One-Click Installer for Windows (1.8.4).
The timeout never occurs. It does however work under Fedora Core Linux
using Ruby 1.8.4.

I wonder if this is a Ruby problem or a One-Click Installer problem.

--
R. Mark Volkmann
Partner, Object Computing, Inc.