lib/celluloid/actor_proxy.rb in celluloid-0.9.1 vs lib/celluloid/actor_proxy.rb in celluloid-0.10.0

- old
+ new

@@ -52,21 +52,17 @@ Actor.future @mailbox, method_name, *args, &block end # Terminate the associated actor def terminate - raise DeadActorError, "actor already terminated" unless alive? + terminate! + Thread.pass while alive? + end - begin - _send_ :terminate - rescue DeadActorError - # In certain cases this is thrown during termination. This is likely - # a bug in Celluloid's internals, but it shouldn't affect the caller. - # FIXME: track this down and fix it, or at the very least log it - end - - # Always return nil until a dependable exit value can be obtained - nil + # Terminate the associated actor asynchronously + def terminate! + raise DeadActorError, "actor already terminated" unless alive? + @mailbox.system_event TerminationRequest.new end # method_missing black magic to call bang predicate methods asynchronously def method_missing(meth, *args, &block) meth = meth.to_s