From f1471e79662f90d2d584390480ad589a731f900a Mon Sep 17 00:00:00 2001 From: Petr Chalupa Date: Tue, 5 Aug 2014 08:37:49 +0200 Subject: [PATCH] Wait for all children to terminate --- lib/concurrent/actor/behaviour/terminates_children.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/concurrent/actor/behaviour/terminates_children.rb b/lib/concurrent/actor/behaviour/terminates_children.rb index 9bd9323cb..4af948a00 100644 --- a/lib/concurrent/actor/behaviour/terminates_children.rb +++ b/lib/concurrent/actor/behaviour/terminates_children.rb @@ -4,7 +4,7 @@ module Behaviour # Terminates all children when the actor terminates. class TerminatesChildren < Abstract def on_event(event) - children.each { |ch| ch << :terminate! } if event == :terminated + children.map { |ch| ch.ask :terminate! }.each(&:wait) if event == :terminated super event end end