Class: RevealCK::Commands::ThreadWaker
- Inherits:
-
Object
- Object
- RevealCK::Commands::ThreadWaker
- Defined in:
- lib/reveal-ck/commands/thread_waker.rb
Overview
Utility that wakes up a thread periodically
Instance Method Summary collapse
-
#initialize(thread_to_wake, wait_period = 1) ⇒ ThreadWaker
constructor
A new instance of ThreadWaker.
- #run ⇒ Object
Constructor Details
#initialize(thread_to_wake, wait_period = 1) ⇒ ThreadWaker
Returns a new instance of ThreadWaker.
5 6 7 8 |
# File 'lib/reveal-ck/commands/thread_waker.rb', line 5 def initialize(thread_to_wake, wait_period = 1) @thread_to_wake = thread_to_wake @wait_period = wait_period end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/reveal-ck/commands/thread_waker.rb', line 10 def run Thread.new do loop do sleep @wait_period @thread_to_wake.wakeup end end end |