From b31669f4ff26304fd11ebd9bcb77aef76f7da20b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20S=2E=20Montero?= Date: Fri, 30 Jan 2009 18:59:40 +0000 Subject: [PATCH] fix indents and example git-svn-id: http://svn.opennebula.org/one/trunk@335 3034c82b-c49b-4eb3-8279-a7acafdc01c0 --- src/mad/ruby/ActionManager.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mad/ruby/ActionManager.rb b/src/mad/ruby/ActionManager.rb index f5f2a842e2..92b2e546b6 100644 --- a/src/mad/ruby/ActionManager.rb +++ b/src/mad/ruby/ActionManager.rb @@ -34,9 +34,6 @@ class Sample @am = ActionManager.new(15,true) @am.register_action("SLEEP",method("sleep_action")) - @am.register_action("FINALIZE",method("finalize_action"),false) - - @am.start_listener end def sleep_action(secs) @@ -49,10 +46,14 @@ class Sample end end + s = Sample.new - s.am.trigger_action("SLEEP",rand(3)+1) - s.am.trigger_action("FINALIZE") + s.@am.start_listener + +# Objects in other threads can trigger actions like this +# s.am.trigger_action("SLEEP",rand(3)+1) +# s.am.trigger_action("FINALIZE") =end class ActionManager @@ -67,7 +68,6 @@ class ActionManager @finalize = false @actions = Hash.new @threaded = threaded - @listener = nil @concurrency = concurrency @action_queue = Array.new @@ -132,9 +132,9 @@ class ActionManager return if ( @finalize && @running_actions == 0) end - - run_action - } + + run_action + } end end