Class: SystemTimer::ThreadTimer

Inherits:
Object
  • Object
show all
Defined in:
lib/system_timer/thread_timer.rb

Overview

Timer saving associated thread. This is needed because we trigger timers from a Ruby signal handler and Ruby signals are always delivered to main thread.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trigger_time, thread) ⇒ ThreadTimer

Returns a new instance of ThreadTimer.



11
12
13
14
# File 'lib/system_timer/thread_timer.rb', line 11

def initialize(trigger_time, thread)
  @trigger_time = trigger_time
  @thread = thread
end

Instance Attribute Details

#threadObject (readonly)

Returns the value of attribute thread.



9
10
11
# File 'lib/system_timer/thread_timer.rb', line 9

def thread
  @thread
end

#trigger_timeObject (readonly)

Returns the value of attribute trigger_time.



9
10
11
# File 'lib/system_timer/thread_timer.rb', line 9

def trigger_time
  @trigger_time
end

Instance Method Details

#to_sObject



16
17
18
# File 'lib/system_timer/thread_timer.rb', line 16

def to_s
  "<ThreadTimer :time => #{trigger_time}, :thread => #{thread}>"
end