module Celluloid
Public Class Methods
timeout(duration, klass = nil) { || ... }
click to toggle source
Celluloid
Monkey-Patch Alert!!!! I would really like to remove this but, but I first need this pull request accepted: github.com/celluloid/celluloid/pull/491
These methods have kept the same functionality for quite some time, therefore are quite stable, I just moved the locations and updated/corrected the method signatures.
# File lib/timeout/extensions/celluloid.rb, line 30 def self.timeout(duration, klass = nil) bt = caller task = Task.current klass ||= TaskTimeout timers = Thread.current[:celluloid_actor].timers timer = timers.after(duration) do exception = klass.new("execution expired") exception.set_backtrace bt task.resume exception end yield ensure timer.cancel if timer end