Sha256: 414a05a8b80a3a7ff7481fc83cc3613b5c116c88d42e5594efb03393d5419893
Contents?: true
Size: 1.15 KB
Versions: 4
Compression:
Stored size: 1.15 KB
Contents
# # Specifying rufus-scheduler # # Fri Mar 20 22:53:33 JST 2009 # # # bacon $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))) require 'rubygems' require 'fileutils' $:.unshift(File.expand_path('~/tmp/bacon/lib')) # my own bacon for a while require 'bacon' puts Bacon.summary_on_exit # # rufus/scheduler/em # EM or plain ? $plain = ! ARGV.include?('--em') require 'rufus/scheduler' if ( ! $plain) require 'eventmachine' unless (EM.reactor_running?) Thread.new { EM.run { } } sleep 0.200 while (not EM.reactor_running?) Thread.pass end # # all this waiting, especially for the JRuby eventmachine, which seems # rather 'diesel' end end SCHEDULER_CLASS = $plain ? Rufus::Scheduler::PlainScheduler : Rufus::Scheduler::EmScheduler # # helper methods def start_scheduler (opts={}) SCHEDULER_CLASS.start_new(opts) end def stop_scheduler (s) #s.stop(:stop_em => true) #sleep 0.200 # give time to the EM to stop s.stop sleep 0.200 end def wait_next_tick if defined?(EM) t = Thread.current EM.next_tick { t.wakeup } Thread.stop else sleep 0.500 end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
tanzeeb-rufus-scheduler-2.0.7.2 | spec/spec_base.rb |
rufus-scheduler-2.0.6 | spec/spec_base.rb |
rufus-scheduler-2.0.5 | spec/spec_base.rb |
rufus-scheduler-2.0.4 | spec/spec_base.rb |