/usr/lib/ruby/vendor_ruby/celluloid/system_events.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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | module Celluloid
# High-priority internal system events
class SystemEvent; end
# Request to link with another actor
class LinkingRequest < SystemEvent
attr_reader :actor, :type
def initialize(actor, type)
@actor, @type = actor, type.to_sym
raise ArgumentError, "type must be link or unlink" unless [:link, :unlink].include?(@type)
end
def process(links)
case type
when :link then links << actor
when :unlink then links.delete actor
end
actor.mailbox << LinkingResponse.new(Actor.current, type)
end
end
# Response to a link request
class LinkingResponse
attr_reader :actor, :type
def initialize(actor, type)
@actor, @type = actor, type.to_sym
raise ArgumentError, "type must be link or unlink" unless [:link, :unlink].include?(@type)
end
end
# An actor has exited for the given reason
class ExitEvent < SystemEvent
attr_reader :actor, :reason
def initialize(actor, reason = nil)
@actor, @reason = actor, reason
end
end
# Name an actor at the time it's registered
class NamingRequest < SystemEvent
attr_reader :name
def initialize(name)
@name = name
end
end
# Request for an actor to terminate
class TerminationRequest < SystemEvent; end
# Signal a condition
class SignalConditionRequest < SystemEvent
def initialize(task, value)
@task, @value = task, value
end
attr_reader :task, :value
def call
@task.resume(@value)
end
end
end
|