lib/celluloid/fiber.rb in celluloid-0.6.2 vs lib/celluloid/fiber.rb in celluloid-0.7.0

- old
+ new

@@ -1,6 +1,6 @@ -# Every time I look at this code a little part of me dies... +# Fibers are hard... let's go shopping! begin require 'fiber' rescue LoadError => ex if defined? JRUBY_VERSION if RUBY_VERSION < "1.9.2" @@ -28,35 +28,6 @@ # If we're on Rubinius, we can still work in 1.8 mode Fiber = Rubinius::Fiber else raise ex end -end - -module Celluloid - class Fiber < ::Fiber - def initialize(*args) - actor = Thread.current[:actor] - mailbox = Thread.current[:mailbox] - - super do - Thread.current[:actor] = actor - Thread.current[:mailbox] = mailbox - - yield(*args) - end - end - - def resume(value = nil) - result = super - actor = Thread.current[:actor] - return result unless actor - - if result.is_a? Celluloid::Call - actor.register_fiber result, self - elsif result - Celluloid::Logger.debug("non-call returned from fiber: #{result.class}") - end - nil - end - end -end +end \ No newline at end of file