/usr/lib/ruby/vendor_ruby/celluloid/proxies/actor_proxy.rb is in ruby-celluloid 0.16.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | module Celluloid
# A proxy which controls the Actor lifecycle
class ActorProxy < AbstractProxy
attr_reader :thread, :mailbox
# Used for reflecting on proxy objects themselves
def __class__; ActorProxy; end
def initialize(thread, mailbox)
@thread = thread
@mailbox = mailbox
end
def inspect
# TODO: use a system event to fetch actor state: tasks?
"#<Celluloid::ActorProxy(#{@mailbox.address}) alive>"
rescue DeadActorError
"#<Celluloid::ActorProxy(#{@mailbox.address}) dead>"
end
def alive?
@mailbox.alive?
end
# Terminate the associated actor
def terminate
terminate!
Actor.join(self)
nil
end
# Terminate the associated actor asynchronously
def terminate!
::Kernel.raise DeadActorError, "actor already terminated" unless alive?
@mailbox << TerminationRequest.new
end
end
end
|