module TimeLimit(T)

Defined in:

time-limit.cr

Constant Summary

VERSION = "0.1.0"

Class Method Summary

Class Method Detail

def self.spawn(limit : Time::Span, &block : -> T) : T | Nil #

Spawn a fiber that with an execution time limit.

If the block runs successfully, the result is returned. If the block raises an exception, it gets re-raised. If the time limit is reached, a TimeLimit::TimeoutException is raised.


[View source]