Use ruby Timeout class as background thread

Posted by turri on Stack Overflow See other posts from Stack Overflow or by turri
Published on 2010-04-02T15:32:12Z Indexed on 2010/06/08 3:02 UTC
Read the original article Hit count: 170

Filed under:

I found ruby class Timeout very useful for my project.

But i need to run a block of code in background and keep it under a timeout..

For example

Timeout::timeout(2) { block.call }

How to do that?

© Stack Overflow or respective owner

Related posts about ruby