Class: Puma::ThreadPool::ProcessorThread

Inherits:
Object
  • Object
show all
Defined in:
lib/puma/thread_pool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

Parameters:

  • value

    the value to set the attribute marked_as_io_thread to.



30
31
32
# File 'lib/puma/thread_pool.rb', line 30

def marked_as_io_thread=(value)
  @marked_as_io_thread = value
end

#threadObject

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

Returns:

  • (Boolean)


52
53
54
# File 'lib/puma/thread_pool.rb', line 52

def alive?
  @thread&.alive?
end

#joinObject



56
57
58
# File 'lib/puma/thread_pool.rb', line 56

def join(...)
  @thread.join(...)
end

#killObject



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

Returns:

  • (Boolean)


48
49
50
# File 'lib/puma/thread_pool.rb', line 48

def marked_as_io_thread?
  @marked_as_io_thread
end

#raiseObject



68
69
70
# File 'lib/puma/thread_pool.rb', line 68

def raise(...)
  @thread.raise(...)
end