summaryrefslogtreecommitdiffstats
path: root/lib/edoors
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-06-11 22:39:34 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-06-11 22:39:34 +0200
commit634135e41fb743fd70566a3f4b1c8cc33bbc8112 (patch)
treea5a913e4887d93454c41d21b2172d2478ae23e36 /lib/edoors
parenta19c8e272ac87c1494a975955854b8daa368bf27 (diff)
downloadedoors-ruby-634135e41fb743fd70566a3f4b1c8cc33bbc8112.zip
edoors-ruby-634135e41fb743fd70566a3f4b1c8cc33bbc8112.tar.gz
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
Diffstat (limited to 'lib/edoors')
-rw-r--r--lib/edoors/particle.rb8
1 files 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
#