From 634135e41fb743fd70566a3f4b1c8cc33bbc8112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 11 Jun 2012 22:39:34 +0200 Subject: Particle#clear_merged! add a parameter r=nil if r is set, it's used as receiver for#release_p call, which allows to return the merged particle to the Spin instead of ruby GC --- lib/edoors/particle.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/edoors/particle.rb b/lib/edoors/particle.rb index c17f551..84f6ece 100644 --- a/lib/edoors/particle.rb +++ b/lib/edoors/particle.rb @@ -77,11 +77,11 @@ module Edoors # # called when released def reset! + clear_merged! ( @src ? @src : ( @dst ? @dst : nil ) ) @ts = @src = @dst = @room = @door = @action = @link_value = nil @dsts.clear @link_fields.clear @payload.clear - @merged.clear end # # called when sent @@ -220,7 +220,11 @@ module Edoors @merged.shift end # - def clear_merged! + def clear_merged! r=nil + @merged.each do |p| + p.clear_merged! r + r.release_p p if r + end @merged.clear end # -- cgit v1.1-2-g2b99