lib/celluloid.rb in celluloid-0.17.4 vs lib/celluloid.rb in celluloid-0.18.0.pre
- old
+ new
@@ -146,37 +146,27 @@
init
start
end
def init
- @actor_system = Actor::System.new
+ @actor_system ||= Actor::System.new
end
def start
actor_system.start
end
def running?
actor_system && actor_system.running?
end
+ #de TODO Anticipate outside process finalizer that would by-pass this.
def register_shutdown
return if defined?(@shutdown_registered) && @shutdown_registered
-
- # Terminate all actors at exit
+ # Terminate all actors at exit, unless the exit is abnormal.
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
- exit exit_status if exit_status
- else
- Celluloid.shutdown
- end
+ Celluloid.shutdown unless $!
end
@shutdown_registered = true
end
# Shut down all running actors
@@ -528,10 +518,5 @@
Celluloid.const_get(str)
rescue NameError
Celluloid::Group.const_get(str)
end
end
-
-unless defined?($CELLULOID_TEST) && $CELLULOID_TEST
- Celluloid.register_shutdown
- Celluloid.init
-end