The following message is a courtesy copy of an article that has been posted to comp.lang.misc as well. Hugh Sasse Staff Elec Eng <hgs / dmu.ac.uk> writes: > Is there a correct Ruby idiom for timing out an operation? There seems > to be no alarm function in Ruby, so I cannot do it the Perl way: You could use lib/timeout.rb: require 'timeout' status = timeout(5) { # something may take time } > (to quote the Perl Cookbook). I suppose one could do it with a call to > fork, have the parent send signal 0 to the child to see if it still lives, > and repeat this every (short time) until the child dies or the timeout > is reached. If I can do this without the fork it would be better though. > Is there a better way? It uses threads, which are more efficient, but the principle's the same. Regards Dave