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.
302 303 304 305 306 307 308 |
# File 'lib/puma/thread_pool.rb', line 302 def initialize(pool, timeout, thread_name, ) @pool = pool @timeout = timeout @thread_name = thread_name @message = @running = false end |
Instance Method Details
#start! ⇒ Object
310 311 312 313 314 315 316 317 318 319 320 |
# File 'lib/puma/thread_pool.rb', line 310 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
322 323 324 325 |
# File 'lib/puma/thread_pool.rb', line 322 def stop @running = false @thread.wakeup end |