Class: Pallets::Scheduler
- Inherits:
-
Object
- Object
- Pallets::Scheduler
- Defined in:
- lib/pallets/scheduler.rb
Instance Method Summary collapse
- #debug ⇒ Object
- #id ⇒ Object
-
#initialize(manager, backend) ⇒ Scheduler
constructor
A new instance of Scheduler.
- #needs_to_stop? ⇒ Boolean
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(manager, backend) ⇒ Scheduler
Returns a new instance of Scheduler.
3 4 5 6 7 8 |
# File 'lib/pallets/scheduler.rb', line 3 def initialize(manager, backend) @manager = manager @backend = backend @needs_to_stop = false @thread = nil end |
Instance Method Details
#debug ⇒ Object
25 26 27 |
# File 'lib/pallets/scheduler.rb', line 25 def debug @thread.backtrace end |
#id ⇒ Object
29 30 31 |
# File 'lib/pallets/scheduler.rb', line 29 def id "S#{@thread.object_id.to_s(36)}".upcase if @thread end |
#needs_to_stop? ⇒ Boolean
21 22 23 |
# File 'lib/pallets/scheduler.rb', line 21 def needs_to_stop? @needs_to_stop end |
#shutdown ⇒ Object
14 15 16 17 18 19 |
# File 'lib/pallets/scheduler.rb', line 14 def shutdown @needs_to_stop = true return unless @thread @thread.join end |
#start ⇒ Object
10 11 12 |
# File 'lib/pallets/scheduler.rb', line 10 def start @thread ||= Thread.new { wait_initial_bit; work } end |