celluloid 0.17.2 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
 - data/CHANGES.md +340 -75
 - data/CONDUCT.md +13 -0
 - data/CONTRIBUTING.md +39 -0
 - data/LICENSE.txt +1 -1
 - data/README.md +54 -150
 - data/REFACTOR.md +1 -0
 - data/architecture.md +120 -0
 - data/examples/basic_usage.rb +1 -1
 - data/examples/configurations.rb +78 -0
 - data/examples/futures.rb +1 -1
 - data/examples/ring.rb +5 -4
 - data/examples/simple_pmap.rb +1 -1
 - data/examples/stack.rb +2 -2
 - data/examples/supervisors_and_registry.rb +82 -0
 - data/examples/timers.rb +2 -2
 - data/lib/celluloid.rb +78 -65
 - data/lib/celluloid/actor.rb +27 -17
 - data/lib/celluloid/actor/system.rb +13 -29
 - data/lib/celluloid/autostart.rb +6 -1
 - data/lib/celluloid/call/async.rb +2 -0
 - data/lib/celluloid/call/sync.rb +10 -3
 - data/lib/celluloid/calls.rb +13 -13
 - data/lib/celluloid/cell.rb +5 -9
 - data/lib/celluloid/condition.rb +3 -3
 - data/lib/celluloid/core_ext.rb +0 -2
 - data/lib/celluloid/debug.rb +3 -0
 - data/lib/celluloid/exceptions.rb +2 -2
 - data/lib/celluloid/future.rb +8 -10
 - data/lib/celluloid/group.rb +16 -6
 - data/lib/celluloid/group/pool.rb +1 -3
 - data/lib/celluloid/group/spawner.rb +2 -6
 - data/lib/celluloid/internals/call_chain.rb +15 -0
 - data/lib/celluloid/internals/cpu_counter.rb +62 -0
 - data/lib/celluloid/internals/handlers.rb +42 -0
 - data/lib/celluloid/internals/links.rb +38 -0
 - data/lib/celluloid/internals/logger.rb +104 -0
 - data/lib/celluloid/internals/method.rb +34 -0
 - data/lib/celluloid/internals/properties.rb +32 -0
 - data/lib/celluloid/internals/receivers.rb +64 -0
 - data/lib/celluloid/internals/registry.rb +102 -0
 - data/lib/celluloid/internals/responses.rb +46 -0
 - data/lib/celluloid/internals/signals.rb +24 -0
 - data/lib/celluloid/internals/stack.rb +74 -0
 - data/lib/celluloid/internals/stack/dump.rb +12 -0
 - data/lib/celluloid/internals/stack/states.rb +72 -0
 - data/lib/celluloid/internals/stack/summary.rb +12 -0
 - data/lib/celluloid/internals/task_set.rb +51 -0
 - data/lib/celluloid/internals/thread_handle.rb +52 -0
 - data/lib/celluloid/internals/uuid.rb +40 -0
 - data/lib/celluloid/logging/incident.rb +21 -0
 - data/lib/celluloid/logging/incident_logger.rb +147 -0
 - data/lib/celluloid/logging/incident_reporter.rb +49 -0
 - data/lib/celluloid/logging/log_event.rb +20 -0
 - data/lib/celluloid/logging/ring_buffer.rb +64 -0
 - data/lib/celluloid/mailbox.rb +22 -9
 - data/lib/celluloid/mailbox/evented.rb +13 -7
 - data/lib/celluloid/notifications.rb +95 -0
 - data/lib/celluloid/pool.rb +6 -0
 - data/lib/celluloid/probe.rb +81 -0
 - data/lib/celluloid/proxy/abstract.rb +38 -7
 - data/lib/celluloid/proxy/actor.rb +0 -5
 - data/lib/celluloid/proxy/async.rb +2 -18
 - data/lib/celluloid/proxy/block.rb +2 -1
 - data/lib/celluloid/proxy/cell.rb +1 -7
 - data/lib/celluloid/proxy/future.rb +3 -21
 - data/lib/celluloid/proxy/sync.rb +2 -20
 - data/lib/celluloid/rspec.rb +22 -34
 - data/lib/celluloid/supervision.rb +17 -0
 - data/lib/celluloid/supervision/configuration.rb +169 -0
 - data/lib/celluloid/supervision/configuration/injections.rb +8 -0
 - data/lib/celluloid/supervision/configuration/instance.rb +113 -0
 - data/lib/celluloid/supervision/constants.rb +123 -0
 - data/lib/celluloid/supervision/container.rb +144 -0
 - data/lib/celluloid/supervision/container/behavior.rb +89 -0
 - data/lib/celluloid/supervision/container/behavior/pool.rb +71 -0
 - data/lib/celluloid/supervision/container/behavior/tree.rb +23 -0
 - data/lib/celluloid/supervision/container/injections.rb +8 -0
 - data/lib/celluloid/supervision/container/instance.rb +116 -0
 - data/lib/celluloid/supervision/container/pool.rb +210 -0
 - data/lib/celluloid/supervision/service.rb +27 -0
 - data/lib/celluloid/supervision/supervise.rb +34 -0
 - data/lib/celluloid/supervision/validation.rb +40 -0
 - data/lib/celluloid/supervision/version.rb +5 -0
 - data/lib/celluloid/system_events.rb +10 -3
 - data/lib/celluloid/task.rb +25 -12
 - data/lib/celluloid/task/fibered.rb +6 -2
 - data/lib/celluloid/task/threaded.rb +3 -3
 - data/lib/celluloid/test.rb +5 -2
 - data/lib/celluloid/thread.rb +0 -2
 - data/lib/celluloid/version.rb +1 -1
 - data/spec/celluloid/block_spec.rb +29 -32
 - data/spec/celluloid/calls_spec.rb +5 -15
 - data/spec/celluloid/future_spec.rb +7 -1
 - data/spec/celluloid/internals/cpu_counter_spec.rb +129 -0
 - data/spec/celluloid/internals/links_spec.rb +43 -0
 - data/spec/celluloid/internals/properties_spec.rb +40 -0
 - data/spec/celluloid/internals/registry_spec.rb +62 -0
 - data/spec/celluloid/internals/stack/dump_spec.rb +4 -0
 - data/spec/celluloid/internals/stack/summary_spec.rb +4 -0
 - data/spec/celluloid/internals/thread_handle_spec.rb +60 -0
 - data/spec/celluloid/internals/uuid_spec.rb +9 -0
 - data/spec/celluloid/logging/ring_buffer_spec.rb +36 -0
 - data/spec/celluloid/mailbox/evented_spec.rb +21 -19
 - data/spec/celluloid/misc/leak_spec.rb +3 -4
 - data/spec/celluloid/notifications_spec.rb +140 -0
 - data/spec/celluloid/probe_spec.rb +102 -0
 - data/spec/celluloid/proxy_spec.rb +33 -0
 - data/spec/celluloid/supervision/behavior_spec.rb +74 -0
 - data/spec/celluloid/supervision/configuration_spec.rb +181 -0
 - data/spec/celluloid/supervision/container_spec.rb +72 -0
 - data/spec/celluloid/supervision/instance_spec.rb +13 -0
 - data/spec/celluloid/supervision/root_spec.rb +28 -0
 - data/spec/celluloid/supervision/supervisor_spec.rb +93 -0
 - data/spec/celluloid/task/fibered_spec.rb +1 -3
 - data/spec/celluloid/task/threaded_spec.rb +1 -3
 - data/spec/shared/actor_examples.rb +65 -29
 - data/spec/shared/group_examples.rb +2 -2
 - data/spec/shared/mailbox_examples.rb +1 -1
 - data/spec/shared/stack_examples.rb +87 -0
 - data/spec/shared/task_examples.rb +2 -3
 - data/spec/spec_helper.rb +2 -4
 - data/spec/support/configure_rspec.rb +3 -4
 - data/spec/support/coverage.rb +2 -4
 - data/spec/support/crash_checking.rb +2 -2
 - data/spec/support/examples/actor_class.rb +3 -8
 - data/spec/support/examples/call_class.rb +2 -2
 - data/spec/support/examples/container_class.rb +35 -0
 - data/spec/support/examples/evented_mailbox_class.rb +1 -2
 - data/spec/support/examples/stack_classes.rb +58 -0
 - data/spec/support/examples/stack_methods.rb +23 -0
 - data/spec/support/examples/subordinate_class.rb +19 -0
 - data/spec/support/logging.rb +3 -34
 - data/spec/support/loose_threads.rb +3 -24
 - data/spec/support/reset_class_variables.rb +5 -1
 - data/spec/support/stubbing.rb +1 -1
 - metadata +93 -291
 - data/culture/CONDUCT.md +0 -28
 - data/culture/Gemfile +0 -9
 - data/culture/LICENSE.txt +0 -22
 - data/culture/README.md +0 -22
 - data/culture/Rakefile +0 -5
 - data/culture/SYNC.md +0 -70
 - data/culture/celluloid-culture.gemspec +0 -18
 - data/culture/gems/README.md +0 -39
 - data/culture/gems/dependencies.yml +0 -85
 - data/culture/gems/loader.rb +0 -101
 - data/culture/rubocop/README.md +0 -38
 - data/culture/rubocop/lint.yml +0 -8
 - data/culture/rubocop/metrics.yml +0 -15
 - data/culture/rubocop/perf.yml +0 -0
 - data/culture/rubocop/rubocop.yml +0 -5
 - data/culture/rubocop/style.yml +0 -57
 - data/culture/spec/gems_spec.rb +0 -2
 - data/culture/spec/spec_helper.rb +0 -0
 - data/culture/spec/sync_spec.rb +0 -2
 - data/culture/sync.rb +0 -56
 - data/culture/tasks/rspec.rake +0 -5
 - data/culture/tasks/rubocop.rake +0 -2
 - data/lib/celluloid/actor/manager.rb +0 -7
 - data/lib/celluloid/backported.rb +0 -2
 - data/lib/celluloid/current.rb +0 -2
 - data/lib/celluloid/deprecate.rb +0 -21
 - data/lib/celluloid/fiber.rb +0 -32
 - data/lib/celluloid/managed.rb +0 -3
 - data/lib/celluloid/notices.rb +0 -15
 - data/spec/celluloid/actor/manager_spec.rb +0 -0
 - data/spec/deprecate/actor_system_spec.rb +0 -72
 - data/spec/deprecate/block_spec.rb +0 -52
 - data/spec/deprecate/calls_spec.rb +0 -39
 - data/spec/deprecate/evented_mailbox_spec.rb +0 -34
 - data/spec/deprecate/future_spec.rb +0 -32
 - data/spec/deprecate/internal_pool_spec.rb +0 -4
 - data/spec/support/env.rb +0 -21
 
| 
         @@ -0,0 +1,95 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Celluloid
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Notifications
         
     | 
| 
      
 3 
     | 
    
         
            +
                def self.notifier
         
     | 
| 
      
 4 
     | 
    
         
            +
                  Actor[:notifications_fanout] || raise(DeadActorError, "notifications fanout actor not running")
         
     | 
| 
      
 5 
     | 
    
         
            +
                end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def publish(pattern, *args)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Celluloid::Notifications.notifier.publish(pattern, *args)
         
     | 
| 
      
 9 
     | 
    
         
            +
                rescue DeadActorError
         
     | 
| 
      
 10 
     | 
    
         
            +
                  # Bad shutdown logic. Oh well....
         
     | 
| 
      
 11 
     | 
    
         
            +
                  # TODO: needs a tests
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                module_function :publish
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def subscribe(pattern, method)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  Celluloid::Notifications.notifier.subscribe(Actor.current, pattern, method)
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def unsubscribe(*args)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  Celluloid::Notifications.notifier.unsubscribe(*args)
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                class Fanout
         
     | 
| 
      
 25 
     | 
    
         
            +
                  include Celluloid
         
     | 
| 
      
 26 
     | 
    
         
            +
                  trap_exit :prune
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  def initialize
         
     | 
| 
      
 29 
     | 
    
         
            +
                    @subscribers = []
         
     | 
| 
      
 30 
     | 
    
         
            +
                    @listeners_for = {}
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  def subscribe(actor, pattern, method)
         
     | 
| 
      
 34 
     | 
    
         
            +
                    subscriber = Subscriber.new(actor, pattern, method).tap do |s|
         
     | 
| 
      
 35 
     | 
    
         
            +
                      @subscribers << s
         
     | 
| 
      
 36 
     | 
    
         
            +
                    end
         
     | 
| 
      
 37 
     | 
    
         
            +
                    link actor
         
     | 
| 
      
 38 
     | 
    
         
            +
                    @listeners_for.clear
         
     | 
| 
      
 39 
     | 
    
         
            +
                    subscriber
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  def unsubscribe(subscriber)
         
     | 
| 
      
 43 
     | 
    
         
            +
                    @subscribers.reject! { |s| s.matches?(subscriber) }
         
     | 
| 
      
 44 
     | 
    
         
            +
                    @listeners_for.clear
         
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  def publish(pattern, *args)
         
     | 
| 
      
 48 
     | 
    
         
            +
                    listeners_for(pattern).each { |s| s.publish(pattern, *args) }
         
     | 
| 
      
 49 
     | 
    
         
            +
                  end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                  def listeners_for(pattern)
         
     | 
| 
      
 52 
     | 
    
         
            +
                    @listeners_for[pattern] ||= @subscribers.select { |s| s.subscribed_to?(pattern) }
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                  def listening?(pattern)
         
     | 
| 
      
 56 
     | 
    
         
            +
                    listeners_for(pattern).any?
         
     | 
| 
      
 57 
     | 
    
         
            +
                  end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                  def prune(actor, _reason = nil)
         
     | 
| 
      
 60 
     | 
    
         
            +
                    @subscribers.reject! { |s| s.actor == actor }
         
     | 
| 
      
 61 
     | 
    
         
            +
                    @listeners_for.clear
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                class Subscriber
         
     | 
| 
      
 66 
     | 
    
         
            +
                  attr_accessor :actor, :pattern, :method
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                  def initialize(actor, pattern, method)
         
     | 
| 
      
 69 
     | 
    
         
            +
                    @actor = actor
         
     | 
| 
      
 70 
     | 
    
         
            +
                    @pattern = pattern
         
     | 
| 
      
 71 
     | 
    
         
            +
                    @method = method
         
     | 
| 
      
 72 
     | 
    
         
            +
                  end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                  def publish(pattern, *args)
         
     | 
| 
      
 75 
     | 
    
         
            +
                    actor.async method, pattern, *args
         
     | 
| 
      
 76 
     | 
    
         
            +
                  rescue DeadActorError
         
     | 
| 
      
 77 
     | 
    
         
            +
                    # TODO: needs a tests
         
     | 
| 
      
 78 
     | 
    
         
            +
                    # Bad shutdown logic. Oh well....
         
     | 
| 
      
 79 
     | 
    
         
            +
                  end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                  def subscribed_to?(pattern)
         
     | 
| 
      
 82 
     | 
    
         
            +
                    !pattern || @pattern === pattern.to_s || @pattern === pattern
         
     | 
| 
      
 83 
     | 
    
         
            +
                  end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                  def matches?(subscriber_or_pattern)
         
     | 
| 
      
 86 
     | 
    
         
            +
                    self === subscriber_or_pattern ||
         
     | 
| 
      
 87 
     | 
    
         
            +
                      @pattern && @pattern === subscriber_or_pattern
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end
         
     | 
| 
      
 89 
     | 
    
         
            +
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
              end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
              def self.publish(*args)
         
     | 
| 
      
 93 
     | 
    
         
            +
                Notifications.publish(*args)
         
     | 
| 
      
 94 
     | 
    
         
            +
              end
         
     | 
| 
      
 95 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,81 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "celluloid"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # !!! DO NOT INTRODUCE ADDITIONAL GLOBAL VARIABLES !!!
         
     | 
| 
      
 4 
     | 
    
         
            +
            # rubocop:disable Style/GlobalVars
         
     | 
| 
      
 5 
     | 
    
         
            +
            $CELLULOID_MONITORING = true
         
     | 
| 
      
 6 
     | 
    
         
            +
            # rubocop:enable Style/GlobalVars
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            module Celluloid
         
     | 
| 
      
 9 
     | 
    
         
            +
              class Probe
         
     | 
| 
      
 10 
     | 
    
         
            +
                include Celluloid
         
     | 
| 
      
 11 
     | 
    
         
            +
                include Celluloid::Notifications
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                NOTIFICATIONS_TOPIC_BASE = "celluloid.events.%s".freeze
         
     | 
| 
      
 14 
     | 
    
         
            +
                EVENTS_BUFFER = Queue.new
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 17 
     | 
    
         
            +
                  def run
         
     | 
| 
      
 18 
     | 
    
         
            +
                    # spawn the actor if not found
         
     | 
| 
      
 19 
     | 
    
         
            +
                    supervise_as(:probe_actor) unless Actor[:probe_actor] && Actor[:probe_actor].alive?
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def run_without_supervision
         
     | 
| 
      
 23 
     | 
    
         
            +
                    Actor[:probe_actor] = Celluloid::Probe.new
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def actor_created(actor)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    trigger_event(:actor_created, actor)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  def actor_named(actor)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    trigger_event(:actor_named, actor)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  def actor_died(actor)
         
     | 
| 
      
 35 
     | 
    
         
            +
                    trigger_event(:actor_died, actor)
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                  def actors_linked(a, b)
         
     | 
| 
      
 39 
     | 
    
         
            +
                    a = find_actor(a)
         
     | 
| 
      
 40 
     | 
    
         
            +
                    b = find_actor(b)
         
     | 
| 
      
 41 
     | 
    
         
            +
                    trigger_event(:actors_linked, a, b)
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  private
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                  def trigger_event(name, *args)
         
     | 
| 
      
 47 
     | 
    
         
            +
                    # !!! DO NOT INTRODUCE ADDITIONAL GLOBAL VARIABLES !!!
         
     | 
| 
      
 48 
     | 
    
         
            +
                    # rubocop:disable Style/GlobalVars
         
     | 
| 
      
 49 
     | 
    
         
            +
                    return unless $CELLULOID_MONITORING
         
     | 
| 
      
 50 
     | 
    
         
            +
                    # rubocop:enable Style/GlobalVars
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                    EVENTS_BUFFER << [name, args]
         
     | 
| 
      
 53 
     | 
    
         
            +
                    probe_actor = Actor[:probe_actor]
         
     | 
| 
      
 54 
     | 
    
         
            +
                    probe_actor.async.process_queue if probe_actor
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  def find_actor(obj)
         
     | 
| 
      
 58 
     | 
    
         
            +
                    if obj.__send__(:class) == Actor
         
     | 
| 
      
 59 
     | 
    
         
            +
                      obj
         
     | 
| 
      
 60 
     | 
    
         
            +
                    elsif owner = obj.instance_variable_get(OWNER_IVAR)
         
     | 
| 
      
 61 
     | 
    
         
            +
                      owner
         
     | 
| 
      
 62 
     | 
    
         
            +
                    end
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 67 
     | 
    
         
            +
                  async.process_queue
         
     | 
| 
      
 68 
     | 
    
         
            +
                end
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                def process_queue
         
     | 
| 
      
 71 
     | 
    
         
            +
                  until EVENTS_BUFFER.empty?
         
     | 
| 
      
 72 
     | 
    
         
            +
                    event = EVENTS_BUFFER.pop
         
     | 
| 
      
 73 
     | 
    
         
            +
                    dispatch_event(*event)
         
     | 
| 
      
 74 
     | 
    
         
            +
                  end
         
     | 
| 
      
 75 
     | 
    
         
            +
                end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                def dispatch_event(cmd, args)
         
     | 
| 
      
 78 
     | 
    
         
            +
                  publish(NOTIFICATIONS_TOPIC_BASE % cmd, args)
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
              end
         
     | 
| 
      
 81 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,12 +1,14 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            class  
     | 
| 
       3 
     | 
    
         
            -
               
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                ::Celluloid::Proxy::Abstract
         
     | 
| 
      
 1 
     | 
    
         
            +
            module Celluloid::Proxy
         
     | 
| 
      
 2 
     | 
    
         
            +
              # Looks up the actual class of instance, even if instance is a proxy.
         
     | 
| 
      
 3 
     | 
    
         
            +
              def self.class_of(instance)
         
     | 
| 
      
 4 
     | 
    
         
            +
                (class << instance; self; end).superclass
         
     | 
| 
       6 
5 
     | 
    
         
             
              end
         
     | 
| 
      
 6 
     | 
    
         
            +
            end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
      
 8 
     | 
    
         
            +
            # Base class of Celluloid proxies
         
     | 
| 
      
 9 
     | 
    
         
            +
            class Celluloid::Proxy::Abstract < BasicObject
         
     | 
| 
       8 
10 
     | 
    
         
             
              # Needed for storing proxies in data structures
         
     | 
| 
       9 
     | 
    
         
            -
              needed = [ 
     | 
| 
      
 11 
     | 
    
         
            +
              needed = %i[object_id __id__ hash eql? private_methods] - instance_methods
         
     | 
| 
       10 
12 
     | 
    
         
             
              if needed.any?
         
     | 
| 
       11 
13 
     | 
    
         
             
                include ::Kernel.dup.module_eval {
         
     | 
| 
       12 
14 
     | 
    
         
             
                  undef_method(*(instance_methods - needed))
         
     | 
| 
         @@ -14,6 +16,35 @@ class Celluloid::Proxy::Abstract < BasicObject 
     | 
|
| 
       14 
16 
     | 
    
         
             
                }
         
     | 
| 
       15 
17 
     | 
    
         
             
                # rubinius bug?  These methods disappear when we include hacked kernel
         
     | 
| 
       16 
18 
     | 
    
         
             
                define_method :==, ::BasicObject.instance_method(:==) unless instance_methods.include?(:==)
         
     | 
| 
       17 
     | 
    
         
            -
                 
     | 
| 
      
 19 
     | 
    
         
            +
                alias equal? == unless instance_methods.include?(:equal?)
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              def __class__
         
     | 
| 
      
 23 
     | 
    
         
            +
                @class ||= ::Celluloid::Proxy.class_of(self)
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            class Celluloid::Proxy::AbstractCall < Celluloid::Proxy::Abstract
         
     | 
| 
      
 28 
     | 
    
         
            +
              attr_reader :mailbox
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              def initialize(mailbox, klass)
         
     | 
| 
      
 31 
     | 
    
         
            +
                @mailbox = mailbox
         
     | 
| 
      
 32 
     | 
    
         
            +
                @klass = klass
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              def eql?(other)
         
     | 
| 
      
 36 
     | 
    
         
            +
                __class__.eql?(::Celluloid::Proxy.class_of(other)) && @mailbox.eql?(other.mailbox)
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
              def hash
         
     | 
| 
      
 40 
     | 
    
         
            +
                @mailbox.hash
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              def __klass__
         
     | 
| 
      
 44 
     | 
    
         
            +
                @klass
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              def inspect
         
     | 
| 
      
 48 
     | 
    
         
            +
                "#<#{__class__}(#{@klass})>"
         
     | 
| 
       18 
49 
     | 
    
         
             
              end
         
     | 
| 
       19 
50 
     | 
    
         
             
            end
         
     | 
| 
         @@ -2,11 +2,6 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            class Celluloid::Proxy::Actor < Celluloid::Proxy::Abstract
         
     | 
| 
       3 
3 
     | 
    
         
             
              attr_reader :thread, :mailbox
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
              # Used for reflecting on proxy objects themselves
         
     | 
| 
       6 
     | 
    
         
            -
              def __class__
         
     | 
| 
       7 
     | 
    
         
            -
                ::Celluloid::Proxy::Actor
         
     | 
| 
       8 
     | 
    
         
            -
              end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
5 
     | 
    
         
             
              def initialize(mailbox, thread)
         
     | 
| 
       11 
6 
     | 
    
         
             
                @mailbox = mailbox
         
     | 
| 
       12 
7 
     | 
    
         
             
                @thread = thread
         
     | 
| 
         @@ -1,21 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # A proxy which sends asynchronous calls to an actor
         
     | 
| 
       2 
     | 
    
         
            -
            class Celluloid::Proxy::Async < Celluloid::Proxy:: 
     | 
| 
       3 
     | 
    
         
            -
              attr_reader :mailbox
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              # Used for reflecting on proxy objects themselves
         
     | 
| 
       6 
     | 
    
         
            -
              def __class__
         
     | 
| 
       7 
     | 
    
         
            -
                ::Celluloid::Proxy::Async
         
     | 
| 
       8 
     | 
    
         
            -
              end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
              def initialize(mailbox, klass)
         
     | 
| 
       11 
     | 
    
         
            -
                @mailbox = mailbox
         
     | 
| 
       12 
     | 
    
         
            -
                @klass = klass
         
     | 
| 
       13 
     | 
    
         
            -
              end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              def inspect
         
     | 
| 
       16 
     | 
    
         
            -
                "#<Celluloid::Proxy::Async(#{@klass})>"
         
     | 
| 
       17 
     | 
    
         
            -
              end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
            class Celluloid::Proxy::Async < Celluloid::Proxy::AbstractCall
         
     | 
| 
       19 
3 
     | 
    
         
             
              def method_missing(meth, *args, &block)
         
     | 
| 
       20 
4 
     | 
    
         
             
                if @mailbox == ::Thread.current[:celluloid_mailbox]
         
     | 
| 
       21 
5 
     | 
    
         
             
                  args.unshift meth
         
     | 
| 
         @@ -23,7 +7,7 @@ class Celluloid::Proxy::Async < Celluloid::Proxy::Abstract 
     | 
|
| 
       23 
7 
     | 
    
         
             
                end
         
     | 
| 
       24 
8 
     | 
    
         
             
                if block_given?
         
     | 
| 
       25 
9 
     | 
    
         
             
                  # FIXME: nicer exception
         
     | 
| 
       26 
     | 
    
         
            -
                   
     | 
| 
      
 10 
     | 
    
         
            +
                  raise "Cannot use blocks with async yet"
         
     | 
| 
       27 
11 
     | 
    
         
             
                end
         
     | 
| 
       28 
12 
     | 
    
         
             
                @mailbox << ::Celluloid::Call::Async.new(meth, args, block)
         
     | 
| 
       29 
13 
     | 
    
         
             
                self
         
     | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class Celluloid::Proxy::Block
         
     | 
| 
       2 
2 
     | 
    
         
             
              attr_writer :execution
         
     | 
| 
       3 
3 
     | 
    
         
             
              attr_reader :call, :block
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       4 
5 
     | 
    
         
             
              def initialize(mailbox, call, block)
         
     | 
| 
       5 
6 
     | 
    
         
             
                @mailbox = mailbox
         
     | 
| 
       6 
7 
     | 
    
         
             
                @call = call
         
     | 
| 
         @@ -17,7 +18,7 @@ class Celluloid::Proxy::Block 
     | 
|
| 
       17 
18 
     | 
    
         
             
                      task.suspend(:invokeblock)
         
     | 
| 
       18 
19 
     | 
    
         
             
                    else
         
     | 
| 
       19 
20 
     | 
    
         
             
                      # FIXME: better exception
         
     | 
| 
       20 
     | 
    
         
            -
                       
     | 
| 
      
 21 
     | 
    
         
            +
                      raise "No task to suspend"
         
     | 
| 
       21 
22 
     | 
    
         
             
                    end
         
     | 
| 
       22 
23 
     | 
    
         
             
                  end
         
     | 
| 
       23 
24 
     | 
    
         
             
                else
         
     | 
    
        data/lib/celluloid/proxy/cell.rb
    CHANGED
    
    | 
         @@ -1,15 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # A proxy object returned from Celluloid::Actor.new/new_link which converts
         
     | 
| 
       2 
2 
     | 
    
         
             
            # the normal Ruby method protocol into an inter-actor message protocol
         
     | 
| 
       3 
3 
     | 
    
         
             
            class Celluloid::Proxy::Cell < Celluloid::Proxy::Sync
         
     | 
| 
       4 
     | 
    
         
            -
              # Used for reflecting on proxy objects themselves
         
     | 
| 
       5 
     | 
    
         
            -
              def __class__
         
     | 
| 
       6 
     | 
    
         
            -
                ::Celluloid::Proxy::Cell
         
     | 
| 
       7 
     | 
    
         
            -
              end
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
4 
     | 
    
         
             
              def initialize(mailbox, actor_proxy, klass)
         
     | 
| 
       10 
5 
     | 
    
         
             
                super(mailbox, klass)
         
     | 
| 
       11 
6 
     | 
    
         
             
                @actor_proxy  = actor_proxy
         
     | 
| 
       12 
     | 
    
         
            -
                @sync_proxy   = ::Celluloid::Proxy::Sync.new(mailbox, klass)
         
     | 
| 
       13 
7 
     | 
    
         
             
                @async_proxy  = ::Celluloid::Proxy::Async.new(mailbox, klass)
         
     | 
| 
       14 
8 
     | 
    
         
             
                @future_proxy = ::Celluloid::Proxy::Future.new(mailbox, klass)
         
     | 
| 
       15 
9 
     | 
    
         
             
              end
         
     | 
| 
         @@ -28,7 +22,7 @@ class Celluloid::Proxy::Cell < Celluloid::Proxy::Sync 
     | 
|
| 
       28 
22 
     | 
    
         
             
                ::Celluloid::Internals::Method.new(self, name)
         
     | 
| 
       29 
23 
     | 
    
         
             
              end
         
     | 
| 
       30 
24 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
               
     | 
| 
      
 25 
     | 
    
         
            +
              alias sync method_missing
         
     | 
| 
       32 
26 
     | 
    
         | 
| 
       33 
27 
     | 
    
         
             
              # Obtain an async proxy or explicitly invoke a named async method
         
     | 
| 
       34 
28 
     | 
    
         
             
              def async(method_name = nil, *args, &block)
         
     | 
| 
         @@ -1,29 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # A proxy which creates future calls to an actor
         
     | 
| 
       2 
     | 
    
         
            -
            class Celluloid::Proxy::Future < Celluloid::Proxy:: 
     | 
| 
       3 
     | 
    
         
            -
              attr_reader :mailbox
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              # Used for reflecting on proxy objects themselves
         
     | 
| 
       6 
     | 
    
         
            -
              def __class__
         
     | 
| 
       7 
     | 
    
         
            -
                ::Celluloid::Proxy::Future
         
     | 
| 
       8 
     | 
    
         
            -
              end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
              def initialize(mailbox, klass)
         
     | 
| 
       11 
     | 
    
         
            -
                @mailbox = mailbox
         
     | 
| 
       12 
     | 
    
         
            -
                @klass = klass
         
     | 
| 
       13 
     | 
    
         
            -
              end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              def inspect
         
     | 
| 
       16 
     | 
    
         
            -
                "#<Celluloid::Proxy::Future(#{@klass})>"
         
     | 
| 
       17 
     | 
    
         
            -
              end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
            class Celluloid::Proxy::Future < Celluloid::Proxy::AbstractCall
         
     | 
| 
       19 
3 
     | 
    
         
             
              def method_missing(meth, *args, &block)
         
     | 
| 
       20 
     | 
    
         
            -
                unless @mailbox.alive?
         
     | 
| 
       21 
     | 
    
         
            -
                  fail ::Celluloid::DeadActorError, "attempted to call a dead actor"
         
     | 
| 
       22 
     | 
    
         
            -
                end
         
     | 
| 
      
 4 
     | 
    
         
            +
                raise ::Celluloid::DeadActorError, "attempted to call a dead actor: #{meth}" unless @mailbox.alive?
         
     | 
| 
       23 
5 
     | 
    
         | 
| 
       24 
6 
     | 
    
         
             
                if block_given?
         
     | 
| 
       25 
7 
     | 
    
         
             
                  # FIXME: nicer exception
         
     | 
| 
       26 
     | 
    
         
            -
                   
     | 
| 
      
 8 
     | 
    
         
            +
                  raise "Cannot use blocks with futures yet"
         
     | 
| 
       27 
9 
     | 
    
         
             
                end
         
     | 
| 
       28 
10 
     | 
    
         | 
| 
       29 
11 
     | 
    
         
             
                future = ::Celluloid::Future.new
         
     | 
    
        data/lib/celluloid/proxy/sync.rb
    CHANGED
    
    | 
         @@ -1,29 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # A proxy which sends synchronous calls to an actor
         
     | 
| 
       2 
     | 
    
         
            -
            class Celluloid::Proxy::Sync < Celluloid::Proxy:: 
     | 
| 
       3 
     | 
    
         
            -
              attr_reader :mailbox
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              # Used for reflecting on proxy objects themselves
         
     | 
| 
       6 
     | 
    
         
            -
              def __class__
         
     | 
| 
       7 
     | 
    
         
            -
                ::Celluloid::Proxy::Sync
         
     | 
| 
       8 
     | 
    
         
            -
              end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
              def initialize(mailbox, klass)
         
     | 
| 
       11 
     | 
    
         
            -
                @mailbox = mailbox
         
     | 
| 
       12 
     | 
    
         
            -
                @klass = klass
         
     | 
| 
       13 
     | 
    
         
            -
              end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              def inspect
         
     | 
| 
       16 
     | 
    
         
            -
                "#<Celluloid::Proxy::Sync(#{@klass})>"
         
     | 
| 
       17 
     | 
    
         
            -
              end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
            class Celluloid::Proxy::Sync < Celluloid::Proxy::AbstractCall
         
     | 
| 
       19 
3 
     | 
    
         
             
              def respond_to?(meth, include_private = false)
         
     | 
| 
       20 
4 
     | 
    
         
             
                __class__.instance_methods.include?(meth) || method_missing(:respond_to?, meth, include_private)
         
     | 
| 
       21 
5 
     | 
    
         
             
              end
         
     | 
| 
       22 
6 
     | 
    
         | 
| 
       23 
7 
     | 
    
         
             
              def method_missing(meth, *args, &block)
         
     | 
| 
       24 
     | 
    
         
            -
                unless @mailbox.alive?
         
     | 
| 
       25 
     | 
    
         
            -
                  fail ::Celluloid::DeadActorError, "attempted to call a dead actor"
         
     | 
| 
       26 
     | 
    
         
            -
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
                raise ::Celluloid::DeadActorError, "attempted to call a dead actor: #{meth}" unless @mailbox.alive?
         
     | 
| 
       27 
9 
     | 
    
         | 
| 
       28 
10 
     | 
    
         
             
                if @mailbox == ::Thread.current[:celluloid_mailbox]
         
     | 
| 
       29 
11 
     | 
    
         
             
                  args.unshift meth
         
     | 
    
        data/lib/celluloid/rspec.rb
    CHANGED
    
    | 
         @@ -1,41 +1,26 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require "dotenv"
         
     | 
| 
       2 
     | 
    
         
            -
            require "nenv"
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
1 
     | 
    
         
             
            require "celluloid/test"
         
     | 
| 
       5 
2 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            # To help produce better bug reports in Rubinius
         
     | 
| 
       7 
     | 
    
         
            -
            if RUBY_ENGINE == "rbx"
         
     | 
| 
       8 
     | 
    
         
            -
              # $DEBUG = true # would be nice if this didn't fail ... :(
         
     | 
| 
       9 
     | 
    
         
            -
              require "rspec/matchers"
         
     | 
| 
       10 
     | 
    
         
            -
              require "rspec/matchers/built_in/be"
         
     | 
| 
       11 
     | 
    
         
            -
            end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            require "rspec/retry"
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
3 
     | 
    
         
             
            module Specs
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
              CHECK_LOOSE_THREADS = !Nenv.ci? unless defined? CHECK_LOOSE_THREADS
         
     | 
| 
      
 4 
     | 
    
         
            +
              CHECK_LOOSE_THREADS = false
         
     | 
| 
       18 
5 
     | 
    
         
             
              ALLOW_RETRIES = 3 unless defined? ALLOW_RETRIES
         
     | 
| 
       19 
     | 
    
         
            -
              ALLOW_SLOW_MAILBOXES = false unless defined? ALLOW_SLOW_MAILBOXES
         
     | 
| 
       20 
6 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
              INCLUDE_SUPPORT = [
         
     | 
| 
       22 
     | 
    
         
            -
                 
     | 
| 
       23 
     | 
    
         
            -
                 
     | 
| 
       24 
     | 
    
         
            -
                 
     | 
| 
       25 
     | 
    
         
            -
                 
     | 
| 
       26 
     | 
    
         
            -
                 
     | 
| 
       27 
     | 
    
         
            -
                 
     | 
| 
       28 
     | 
    
         
            -
                 
     | 
| 
       29 
     | 
    
         
            -
                 
     | 
| 
       30 
     | 
    
         
            -
                 
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
              ]
         
     | 
| 
      
 7 
     | 
    
         
            +
              INCLUDE_SUPPORT = %w[
         
     | 
| 
      
 8 
     | 
    
         
            +
                logging
         
     | 
| 
      
 9 
     | 
    
         
            +
                sleep_and_wait
         
     | 
| 
      
 10 
     | 
    
         
            +
                reset_class_variables
         
     | 
| 
      
 11 
     | 
    
         
            +
                crash_checking
         
     | 
| 
      
 12 
     | 
    
         
            +
                loose_threads
         
     | 
| 
      
 13 
     | 
    
         
            +
                stubbing
         
     | 
| 
      
 14 
     | 
    
         
            +
                coverage
         
     | 
| 
      
 15 
     | 
    
         
            +
                includer
         
     | 
| 
      
 16 
     | 
    
         
            +
                configure_rspec
         
     | 
| 
      
 17 
     | 
    
         
            +
              ].freeze
         
     | 
| 
       33 
18 
     | 
    
         | 
| 
       34 
19 
     | 
    
         
             
              INCLUDE_PATHS = [
         
     | 
| 
       35 
20 
     | 
    
         
             
                "./spec/support/*.rb",
         
     | 
| 
       36 
21 
     | 
    
         
             
                "./spec/support/examples/*.rb",
         
     | 
| 
       37 
22 
     | 
    
         
             
                "./spec/shared/*.rb"
         
     | 
| 
       38 
     | 
    
         
            -
              ]
         
     | 
| 
      
 23 
     | 
    
         
            +
              ].freeze
         
     | 
| 
       39 
24 
     | 
    
         | 
| 
       40 
25 
     | 
    
         
             
              MAX_EXECUTION = 13
         
     | 
| 
       41 
26 
     | 
    
         
             
              MAX_ATTEMPTS = 20
         
     | 
| 
         @@ -49,24 +34,27 @@ module Specs 
     | 
|
| 
       49 
34 
     | 
    
         
             
                "rspec-retry",
         
     | 
| 
       50 
35 
     | 
    
         
             
                "rubysl-thread",
         
     | 
| 
       51 
36 
     | 
    
         
             
                "rubysl-timeout"
         
     | 
| 
       52 
     | 
    
         
            -
              ]
         
     | 
| 
      
 37 
     | 
    
         
            +
              ].freeze
         
     | 
| 
       53 
38 
     | 
    
         
             
            end
         
     | 
| 
       54 
39 
     | 
    
         | 
| 
      
 40 
     | 
    
         
            +
            # !!! DO NOT INTRODUCE ADDITIONAL GLOBAL VARIABLES !!!
         
     | 
| 
      
 41 
     | 
    
         
            +
            # rubocop:disable Style/GlobalVars
         
     | 
| 
       55 
42 
     | 
    
         
             
            $CELLULOID_DEBUG = true
         
     | 
| 
       56 
43 
     | 
    
         | 
| 
       57 
44 
     | 
    
         
             
            # Require but disable, so it has to be explicitly enabled in tests
         
     | 
| 
       58 
45 
     | 
    
         
             
            require "celluloid/probe"
         
     | 
| 
       59 
46 
     | 
    
         
             
            $CELLULOID_MONITORING = false
         
     | 
| 
      
 47 
     | 
    
         
            +
            # rubocop:enable Style/GlobalVars
         
     | 
| 
       60 
48 
     | 
    
         | 
| 
       61 
49 
     | 
    
         
             
            Celluloid.shutdown_timeout = 1
         
     | 
| 
       62 
50 
     | 
    
         | 
| 
       63 
51 
     | 
    
         
             
            # Load shared examples and test support code for other gems to use.
         
     | 
| 
       64 
52 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
            Specs::INCLUDE_SUPPORT.each  
     | 
| 
       66 
     | 
    
         
            -
              require "#{File.expand_path(' 
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
      
 53 
     | 
    
         
            +
            Specs::INCLUDE_SUPPORT.each do |f|
         
     | 
| 
      
 54 
     | 
    
         
            +
              require "#{File.expand_path('../../spec/support', __dir__)}/#{f}.rb"
         
     | 
| 
      
 55 
     | 
    
         
            +
            end
         
     | 
| 
       68 
56 
     | 
    
         | 
| 
       69 
57 
     | 
    
         
             
            Specs.reset_probe(nil)
         
     | 
| 
       70 
58 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
            Dir["#{File.expand_path(' 
     | 
| 
       72 
     | 
    
         
            -
            Dir["#{File.expand_path(' 
     | 
| 
      
 59 
     | 
    
         
            +
            Dir["#{File.expand_path('../../spec/support/examples', __dir__)}/*.rb"].map { |f| require f }
         
     | 
| 
      
 60 
     | 
    
         
            +
            Dir["#{File.expand_path('../../spec/shared', __dir__)}/*.rb"].map { |f| require f }
         
     |