module LIFX::LAN::Timers

@private

Public Instance Methods

timers() click to toggle source
# File lib/lifx/lan/timers.rb, line 24
def timers
  @timers ||= ::Timers.new
end

Protected Instance Methods

initialize_timer_thread() click to toggle source
# File lib/lifx/lan/timers.rb, line 7
def initialize_timer_thread
  timers.after(1) {} # Just so timers.wait doesn't complain when there's no timer
  @timer_thread = Thread.start do
    loop do
      timers.wait
    end
  end
end
stop_timers() click to toggle source
# File lib/lifx/lan/timers.rb, line 16
def stop_timers
  timers.each(&:cancel)
  if @timer_thread
    @timer_thread.abort
  end
end