summaryrefslogtreecommitdiffstats
path: root/lib/evendoors/twirl.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-10 08:47:02 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-10 08:47:02 +0200
commit274411458b30ba08a9e0adca0a0f5820e9a8648f (patch)
tree7f896cd7b30998c53b000e03ca7d1c66ef6f502c /lib/evendoors/twirl.rb
parentf72393c031018d224318fb4aeff16b6e6c330327 (diff)
downloadedoors-ruby-274411458b30ba08a9e0adca0a0f5820e9a8648f.zip
edoors-ruby-274411458b30ba08a9e0adca0a0f5820e9a8648f.tar.gz
Twirl merge with Space -> Spin is born
Diffstat (limited to 'lib/evendoors/twirl.rb')
-rw-r--r--lib/evendoors/twirl.rb71
1 files changed, 0 insertions, 71 deletions
diff --git a/lib/evendoors/twirl.rb b/lib/evendoors/twirl.rb
deleted file mode 100644
index cb01618..0000000
--- a/lib/evendoors/twirl.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-#! /usr/bin/env ruby
-# -*- coding: UTF-8 -*-
-
-#
-module EvenDoors
- #
- class Twirl
- #
- @debug_routing = false
- @debug_errors = false
- @pool = {} # per particle class free list
- @sys_fifo = [] # system particles fifo list
- @app_fifo = [] # application particles fifo list
- #
- @run = false
- #
- class << self
- #
- attr_accessor :run, :debug_routing, :debug_errors
- #
- def release_p p
- # hope there is no circular loop
- while p2=p.merged_shift
- release_p p2
- end
- ( @pool[p.class] ||= [] ) << p
- end
- #
- def require_p p_kls
- l = @pool[p_kls]
- return p_kls.new if l.nil?
- p = l.pop
- return p_kls.new if p.nil?
- p.reset!
- p
- end
- #
- def send_p p
- @app_fifo << p
- end
- #
- def send_sys_p p
- @sys_fifo << p
- end
- #
- def twirl!
- 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
- end
- while @run and @app_fifo.length>0
- p = @app_fifo.shift
- p.dst.process_p p
- break
- end
- end
- end
- #
- def clear!
- @sys_fifo.clear
- @app_fifo.clear
- end
- #
- end
- #
- end
- #
-end
-#
-# EOF