lib/celluloid.rb in celluloid-0.17.0 vs lib/celluloid.rb in celluloid-0.17.1

- old
+ new

@@ -2,10 +2,11 @@ require "thread" require "timeout" require "set" $CELLULOID_DEBUG = false +$CELLULOID_MANAGED ||= false require "celluloid/version" require "celluloid/notices" $CELLULOID_BACKPORTED = false if defined?(CELLULOID_FUTURE) && CELLULOID_FUTURE @@ -145,11 +146,11 @@ init start end def init - @actor_system = ActorSystem.new + @actor_system = Actor::System.new end def start actor_system.start end @@ -161,10 +162,12 @@ def register_shutdown return if defined?(@shutdown_registered) && @shutdown_registered # Terminate all actors at exit at_exit do + sleep 0.126 # hax grace period for unnaturally terminating actors + # allows "reason" in exit_handler to resolve before being destroyed if defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" && RUBY_VERSION >= "1.9" # workaround for MRI bug losing exit status in at_exit block # http://bugs.ruby-lang.org/issues/5218 exit_status = $ERROR_INFO.status if $ERROR_INFO.is_a?(SystemExit) Celluloid.shutdown @@ -311,13 +314,13 @@ # # Raise an exception in sender context, but stay running def abort(cause) cause = case cause - when String then RuntimeError.new(cause) - when Exception then cause - else fail TypeError, "Exception object/String expected, but #{cause.class} received" + when String then RuntimeError.new(cause) + when Exception then cause + else fail TypeError, "Exception object/String expected, but #{cause.class} received" end fail AbortError.new(cause) end # Terminate this actor @@ -478,11 +481,10 @@ require "celluloid/mailbox/evented" require "celluloid/essentials" require "celluloid/group" -require "celluloid/group/manager" require "celluloid/group/spawner" require "celluloid/group/pool" # TODO: Find way to only load this if being used. require "celluloid/task" require "celluloid/task/fibered" @@ -490,10 +492,11 @@ require "celluloid/actor" require "celluloid/cell" require "celluloid/future" -require "celluloid/actor_system" +require "celluloid/actor/system" +require "celluloid/actor/manager" require "celluloid/deprecate" unless $CELLULOID_BACKPORTED == false $CELLULOID_MONITORING = false Celluloid::Notices.output