Class: Workers::Scheduler
- Inherits:
-
Object
- Object
- Workers::Scheduler
- Defined in:
- lib/workers/scheduler.rb
Instance Method Summary collapse
- #dispose ⇒ Object
-
#initialize(options = {}) ⇒ Scheduler
constructor
A new instance of Scheduler.
- #schedule(timer) ⇒ Object
- #unschedule(timer) ⇒ Object
- #wakeup ⇒ Object
Constructor Details
Instance Method Details
#dispose ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/workers/scheduler.rb', line 34 def dispose @mutex.synchronize do @pool.shutdown @pool.join @thread.kill end return nil end |
#schedule(timer) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/workers/scheduler.rb', line 10 def schedule(timer) @mutex.synchronize do @schedule << timer end wakeup return nil end |
#unschedule(timer) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/workers/scheduler.rb', line 20 def unschedule(timer) @mutex.synchronize do @schedule.delete(timer) end return true end |
#wakeup ⇒ Object
28 29 30 31 32 |
# File 'lib/workers/scheduler.rb', line 28 def wakeup @thread.wakeup return nil end |