lib/celluloid.rb in celluloid-0.15.0.pre2 vs lib/celluloid.rb in celluloid-0.15.0

- old
+ new

@@ -6,11 +6,11 @@ if defined?(JRUBY_VERSION) && JRUBY_VERSION == "1.7.3" raise "Celluloid is broken on JRuby 1.7.3. Please upgrade to 1.7.4+" end module Celluloid - VERSION = '0.15.0.pre2' + VERSION = '0.15.0' Error = Class.new StandardError extend self # expose all instance methods as singleton methods # Warning message added to Celluloid objects accessed outside their actors @@ -414,19 +414,12 @@ end end # Timeout on task suspension (eg Sync calls to other actors) def timeout(duration) - bt = caller - task = Task.current - timer = after(duration) do - exception = Task::TimeoutError.new - exception.set_backtrace bt - task.resume exception + Thread.current[:celluloid_actor].timeout(duration) do + yield end - yield - ensure - timer.cancel if timer end # Run given block in an exclusive mode: all synchronous calls block the whole # actor, not only current message processing. def exclusive(&block)