123456789_123456789_123456789_123456789_123456789_

Class: Puma::ThreadPool::Automaton

Relationships & Source Files
Inherits: Object
Defined in: lib/puma/thread_pool.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(pool, timeout, thread_name, message) ⇒ Automaton

[ GitHub ]

  
# File 'lib/puma/thread_pool.rb', line 296

def initialize(pool, timeout, thread_name, message)
  @pool = pool
  @timeout = timeout
  @thread_name = thread_name
  @message = message
  @running = false
end

Instance Method Details

#start!

[ GitHub ]

  
# File 'lib/puma/thread_pool.rb', line 304

def start!
  @running = true

  @thread = Thread.new do
    Puma.set_thread_name @thread_name
    while @running
      @pool.public_send(@message)
      sleep @timeout
    end
  end
end

#stop

[ GitHub ]

  
# File 'lib/puma/thread_pool.rb', line 316

def stop
  @running = false
  @thread.wakeup
end