Is there a one-threaded alternative to Timeout?
1
There is a Ruby class Timeout that terminates the execution of a block after a certain amount of seconds: Timeout.timeout(5) { # Some long-running code... } The problem is that every time I call timeout() it starts a new Thread . It's pretty expensive (time and memory) operation. Would be much more effective to re-use an existing thread. Are there any Gems for that?
ruby
share | improve this question
asked Nov 12 '18 at 12:05
yegor256
55.3k 87 361 505
...