3 4 5 6 7 8 9 10
# File 'lib/accidentally/patches/thread.rb', line 3 def self.execute_with_timeout(timeout = 0.5) r = nil t = Thread.new { r = yield } t.join(timeout) r end