From: Martin Boese Date: 2010-12-24T16:39:02+09:00 Subject: Secure Timeout I am looking for a secure way to Timeout a block of code. I noticed that 'timeout' (part of ruby) doesn't work if the script is busy in a certain function. For example: require 'timeout' Timeout.timeout(5) do Dir["/**/**"] end ... does NOT break after 5 seconds on my system. In fact not even sending TERM works until Dir[] is finished. I see this also happening on other functions, not just Dir[]. Is it possible to implement a timeout function that can't fail? Any ideas how? Using mainly: Ruby 1.8.7, Linux 2.6.32, FreeBSD 8. Thanks! Martin