Class: Puma::ThreadPool::Automaton
- Inherits:
-
Object
- Object
- Puma::ThreadPool::Automaton
- Defined in:
- lib/puma/thread_pool.rb
Instance Method Summary collapse
-
#initialize(pool, timeout, thread_name, message) ⇒ Automaton
constructor
A new instance of Automaton.
- #start! ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(pool, timeout, thread_name, message) ⇒ Automaton
Returns a new instance of Automaton.
401 402 403 404 405 406 407 |
# File 'lib/puma/thread_pool.rb', line 401 def initialize(pool, timeout, thread_name, ) @pool = pool @timeout = timeout @thread_name = thread_name @message = @running = false end |
Instance Method Details
#start! ⇒ Object
409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/puma/thread_pool.rb', line 409 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 ⇒ Object
421 422 423 424 |
# File 'lib/puma/thread_pool.rb', line 421 def stop @running = false @thread.wakeup end |