Class: Resque::ThreadSignal
- Inherits:
-
Object
- Object
- Resque::ThreadSignal
- Defined in:
- lib/resque/thread_signal.rb
Instance Method Summary collapse
-
#initialize ⇒ ThreadSignal
constructor
A new instance of ThreadSignal.
- #signal ⇒ Object
- #wait_for_signal(timeout) ⇒ Object
Constructor Details
#initialize ⇒ ThreadSignal
Returns a new instance of ThreadSignal.
3 4 5 |
# File 'lib/resque/thread_signal.rb', line 3 def initialize @signaled = false end |
Instance Method Details
#signal ⇒ Object
7 8 9 |
# File 'lib/resque/thread_signal.rb', line 7 def signal @signaled = true end |
#wait_for_signal(timeout) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/resque/thread_signal.rb', line 11 def wait_for_signal(timeout) (10 * timeout).times do sleep(0.1) return true if @signaled end @signaled end |