Sha256: c1b00880230858647241dc5c899e5ed5dd3658f4bb201b25625a5e0f7b2026fa
Contents?: true
Size: 813 Bytes
Versions: 3
Compression:
Stored size: 813 Bytes
Contents
# A proxy which sends synchronous calls to an actor class Celluloid::Proxy::Sync < Celluloid::Proxy::AbstractCall def respond_to?(meth, include_private = false) __class__.instance_methods.include?(meth) || method_missing(:respond_to?, meth, include_private) end def method_missing(meth, *args, &block) unless @mailbox.alive? fail ::Celluloid::DeadActorError, "attempted to call a dead actor: #{meth}" end if @mailbox == ::Thread.current[:celluloid_mailbox] args.unshift meth meth = :__send__ # actor = Thread.current[:celluloid_actor] # actor = actor.behavior.subject.bare_object # return actor.__send__(*args, &block) end call = ::Celluloid::Call::Sync.new(::Celluloid.mailbox, meth, args, block) @mailbox << call call.value end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
celluloid-0.17.4 | lib/celluloid/proxy/sync.rb |
celluloid-0.18.0.pre | lib/celluloid/proxy/sync.rb |
celluloid-0.17.3 | lib/celluloid/proxy/sync.rb |