This file is indexed.

/usr/lib/ruby/vendor_ruby/celluloid/actor_system.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
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
module Celluloid
  class ActorSystem
    extend Forwardable

    def initialize
      @internal_pool = InternalPool.new
      @registry      = Registry.new
    end
    attr_reader :registry

    # Launch default services
    # FIXME: We should set up the supervision hierarchy here
    def start
      within do
        Celluloid::Notifications::Fanout.supervise_as :notifications_fanout
        Celluloid::IncidentReporter.supervise_as :default_incident_reporter, STDERR
      end
      true
    end

    def within
      old = Thread.current[:celluloid_actor_system]
      Thread.current[:celluloid_actor_system] = self
      yield
    ensure
      Thread.current[:celluloid_actor_system] = old
    end

    def get_thread
      @internal_pool.get do
        Thread.current[:celluloid_actor_system] = self
        yield
      end
    end

    def stack_dump
      Celluloid::StackDump.new(@internal_pool)
    end

    def_delegators "@registry", :[], :get, :[]=, :set, :delete

    def registered
      @registry.names
    end

    def clear_registry
      @registry.clear
    end

    def running
      actors = []
      @internal_pool.each do |t|
        next unless t.role == :actor
        actors << t.actor.behavior_proxy if t.actor && t.actor.respond_to?(:behavior_proxy)
      end
      actors
    end

    def running?
      @internal_pool.running?
    end

    # Shut down all running actors
    def shutdown
      actors = running
      Timeout.timeout(shutdown_timeout) do
        Logger.debug "Terminating #{actors.size} #{(actors.size > 1) ? 'actors' : 'actor'}..." if actors.size > 0

        # Actors cannot self-terminate, you must do it for them
        actors.each do |actor|
          begin
            actor.terminate!
          rescue DeadActorError
          end
        end

        actors.each do |actor|
          begin
            Actor.join(actor)
          rescue DeadActorError
          end
        end

        @internal_pool.shutdown
      end
    rescue Timeout::Error
      Logger.error("Couldn't cleanly terminate all actors in #{shutdown_timeout} seconds!")
      actors.each do |actor|
        begin
          Actor.kill(actor)
        rescue DeadActorError, MailboxDead
        end
      end
    ensure
      @internal_pool.kill
      clear_registry
    end

    def assert_inactive
      @internal_pool.assert_inactive
    end

    def shutdown_timeout
      Celluloid.shutdown_timeout
    end
  end
end