summaryrefslogtreecommitdiffstats
path: root/lib/evendoors
diff options
context:
space:
mode:
Diffstat (limited to 'lib/evendoors')
-rw-r--r--lib/evendoors/space.rb1
-rw-r--r--lib/evendoors/twirl.rb10
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/evendoors/space.rb b/lib/evendoors/space.rb
index 6579003..22b9910 100644
--- a/lib/evendoors/space.rb
+++ b/lib/evendoors/space.rb
@@ -13,6 +13,7 @@ module EvenDoors
#
def twirl!
@spots.values.each do |spot| spot.start! end
+ EvenDoors::Twirl.run = true
EvenDoors::Twirl.twirl!
@spots.values.each do |spot| spot.stop! end
end
diff --git a/lib/evendoors/twirl.rb b/lib/evendoors/twirl.rb
index 8742220..9f38bf6 100644
--- a/lib/evendoors/twirl.rb
+++ b/lib/evendoors/twirl.rb
@@ -11,10 +11,11 @@ module EvenDoors
@sys_fifo = [] # system particles fifo list
@app_fifo = [] # application particles fifo list
#
+ @run = false
#
class << self
#
- attr_accessor :debug
+ attr_accessor :debug, :run
#
def release_p p
# hope there is no circular loop
@@ -42,14 +43,15 @@ module EvenDoors
end
#
def twirl!
- while @sys_fifo.length>0 or @app_fifo.length>0
- while @sys_fifo.length>0
+ while @run and (@sys_fifo.length>0 or @app_fifo.length>0)
+ while @run and @sys_fifo.length>0
p = @sys_fifo.shift
p.door.process_sys_p p
end
- while @app_fifo.length>0
+ while @run and @app_fifo.length>0
p = @app_fifo.shift
p.door.process_p p
+ break
end
end
end