In Ruby, I need to time out the execution of a block of code after n milli seconds. I know that the Ruby Timeout library supports timeouts in seconds:
http://ruby-doc.org/stdlib/libdoc/timeout/rdoc/index.html
Is this possible?
In Ruby, I need to time out the execution of a block of code after n milli seconds. I know that the Ruby Timeout library supports timeouts in seconds:
http://ruby-doc.org/stdlib/libdoc/timeout/rdoc/index.html
Is this possible?
Just use a decimal value for the timeout. Example for n milliseconds:
Timeout::timeout(n / 1000.0) { sleep(100) }