Class: SystemTimer::ThreadTimer
- Inherits:
-
Object
- Object
- SystemTimer::ThreadTimer
- 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
-
#exception_class ⇒ Object
readonly
Returns the value of attribute exception_class.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
-
#trigger_time ⇒ Object
readonly
Returns the value of attribute trigger_time.
Instance Method Summary collapse
-
#initialize(trigger_time, thread, exception_class = nil) ⇒ ThreadTimer
constructor
A new instance of ThreadTimer.
- #to_s ⇒ Object
Constructor Details
#initialize(trigger_time, thread, exception_class = nil) ⇒ ThreadTimer
Returns a new instance of ThreadTimer.
11 12 13 14 15 |
# File 'lib/system_timer/thread_timer.rb', line 11 def initialize(trigger_time, thread, exception_class = nil) @trigger_time = trigger_time @thread = thread @exception_class = exception_class || Timeout::Error end |
Instance Attribute Details
#exception_class ⇒ Object (readonly)
Returns the value of attribute exception_class.
9 10 11 |
# File 'lib/system_timer/thread_timer.rb', line 9 def exception_class @exception_class end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
9 10 11 |
# File 'lib/system_timer/thread_timer.rb', line 9 def thread @thread end |
#trigger_time ⇒ Object (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_s ⇒ Object
17 18 19 |
# File 'lib/system_timer/thread_timer.rb', line 17 def to_s "<ThreadTimer :time => #{trigger_time}, :thread => #{thread}, :exception_class => #{exception_class}>" end |