From ae7b1c31a84bdad05376ceccb8882286185f70d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 2 Jun 2012 22:08:08 +0200 Subject: add Particle#dst_reached! end use it it allows us to reset Particle@dst before processing it --- lib/iotas/particle.rb | 6 ++++++ lib/iotas/spin.rb | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/iotas/particle.rb b/lib/iotas/particle.rb index 850c6ad..3cb48b3 100644 --- a/lib/iotas/particle.rb +++ b/lib/iotas/particle.rb @@ -134,6 +134,12 @@ module Iotas @dsts.shift end # + def dst_reached! + d = @dst + @dst = nil + d + end + # def error! e, dst=nil @action = Iotas::ACT_ERROR @dst = dst||@src diff --git a/lib/iotas/spin.rb b/lib/iotas/spin.rb index 6383ff9..e8c48e1 100644 --- a/lib/iotas/spin.rb +++ b/lib/iotas/spin.rb @@ -128,11 +128,11 @@ module Iotas while @run and (@sys_fifo.length>0 or @app_fifo.length>0) while @run and @sys_fifo.length>0 p = @sys_fifo.shift - p.dst.process_sys_p p + p.dst_reached!.process_sys_p p end while @run and @app_fifo.length>0 p = @app_fifo.shift - p.dst.process_p p + p.dst_reached!.process_p p break end end -- cgit v1.1-2-g2b99