Class: Thread
Class Method Summary collapse
Class Method Details
.execute_with_timeout(timeout = 0.5) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/accidently/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 |