/usr/lib/ruby/vendor_ruby/celluloid/proxies/block_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 | module Celluloid
class BlockProxy
def initialize(call, mailbox, block)
@call = call
@mailbox = mailbox
@block = block
@execution = :sender
end
attr_writer :execution
attr_reader :call, :block
def to_proc
if @execution == :sender
lambda do |*values|
if task = Thread.current[:celluloid_task]
@mailbox << BlockCall.new(self, Actor.current.mailbox, values)
# TODO: if respond fails, the Task will never be resumed
task.suspend(:invokeblock)
else
# FIXME: better exception
raise "No task to suspend"
end
end
else
@block
end
end
end
end
|