Class: Puma::ThreadPool::ProcessorThread
- Inherits:
-
Object
- Object
- Puma::ThreadPool::ProcessorThread
- Defined in:
- lib/puma/thread_pool.rb
Instance Attribute Summary collapse
-
#marked_as_io_thread ⇒ Object
writeonly
Sets the attribute marked_as_io_thread.
-
#thread ⇒ Object
Returns the value of attribute thread.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #alive? ⇒ Boolean
-
#initialize(pool) ⇒ ProcessorThread
constructor
A new instance of ProcessorThread.
- #join ⇒ Object
- #kill ⇒ Object
- #mark_as_io_thread! ⇒ Object
- #marked_as_io_thread? ⇒ Boolean
- #raise ⇒ Object
Constructor Details
#initialize(pool) ⇒ ProcessorThread
Returns a new instance of ProcessorThread.
32 33 34 35 36 |
# File 'lib/puma/thread_pool.rb', line 32 def initialize(pool) @pool = pool @thread = nil @marked_as_io_thread = false end |
Instance Attribute Details
#marked_as_io_thread=(value) ⇒ Object (writeonly)
Sets the attribute marked_as_io_thread
30 31 32 |
# File 'lib/puma/thread_pool.rb', line 30 def marked_as_io_thread=(value) @marked_as_io_thread = value end |
#thread ⇒ Object
Returns the value of attribute thread.
29 30 31 |
# File 'lib/puma/thread_pool.rb', line 29 def thread @thread end |
Instance Method Details
#[](key) ⇒ Object
64 65 66 |
# File 'lib/puma/thread_pool.rb', line 64 def [](key) @thread[key] end |
#alive? ⇒ Boolean
52 53 54 |
# File 'lib/puma/thread_pool.rb', line 52 def alive? @thread&.alive? end |
#join ⇒ Object
56 57 58 |
# File 'lib/puma/thread_pool.rb', line 56 def join(...) @thread.join(...) end |
#kill ⇒ Object
60 61 62 |
# File 'lib/puma/thread_pool.rb', line 60 def kill(...) @thread.kill(...) end |
#mark_as_io_thread! ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/puma/thread_pool.rb', line 38 def mark_as_io_thread! unless @marked_as_io_thread @marked_as_io_thread = true # Immediately signal the pool that it can spawn a new thread # if there's some work in the queue. @pool.spawn_thread_if_needed end end |
#marked_as_io_thread? ⇒ Boolean
48 49 50 |
# File 'lib/puma/thread_pool.rb', line 48 def marked_as_io_thread? @marked_as_io_thread end |
#raise ⇒ Object
68 69 70 |
# File 'lib/puma/thread_pool.rb', line 68 def raise(...) @thread.raise(...) end |