-----Original Message-----
From: "Dave Thomas"<Dave / PragmaticProgrammer.com>
To: "ruby-talk ML"<ruby-talk / netlab.co.jp>
Date: Thu Feb 01 10:51:24 PST 2001
Subject: [ruby-talk:10228] Re: limits on computation?

snip
>
>How about:
>
>     require 'timeout'
>
>     begin
>       ans = 0
>       timeout(1) do
>         ans = 1020939**(ARGV[0].to_i)
>       end
>       puts ans
>     rescue TimeoutError
>       puts "Throw another processor in the box"
>     end
>
>
>
>Dave

Have you tried this by chance?  It doesn't work for me.  If, however, I do this:

require 'timeout'

begin
   ans = 0
   timeout(1) do
       sleep 10 #ans = 1020939**28329282
   end
   puts ans
rescue TimeoutError
   puts "Throw another processor in the box"
end

__END__

I get:
Throw another processor in the box

If I remove the sleep 10 and leave the computation, it just sits and starts eating my resources....

Thanks

Mike Wilson
Unix Administrator
http://ruby.weblogs.com
___________________________________________________
GO.com Mail                                    
Get Your Free, Private E-mail at http://mail.go.com