class EventQ::WorkerStatus

Class used to represent the main worker status and the collection of forked worker processes. The main worker process will not have access to a forks collection of processes and threads. This is due to forks getting a copy of the process memory space and there is no such thing as shared resources between child processes and the parent process. Without implementing a need using inter process communication with IO::Pipe, only the PID is of any use for the parent process. To summarize, if using forks, the parent process will only have a collection of PIDS and not any threads associated with those PIDS.

Attributes

processes[R]

List of WorkerProcess

Public Class Methods

new() click to toggle source
# File lib/eventq/worker_status.rb, line 18
def initialize
  @processes = Concurrent::Array.new
end

Public Instance Methods

pids() click to toggle source

Retrieve a simple list of all PIDS.

# File lib/eventq/worker_status.rb, line 23
def pids
  list = []
  @processes.each do |p|
    list.push(p.pid)
  end
  list
end
threads() click to toggle source

Retrieve a simple list of all threads. Important Note: The list of threads is only relevant to the current process.

# File lib/eventq/worker_status.rb, line 33
def threads
  list = []
  @processes.each do |p|
    p.threads.each do |t|
      list.push(t)
    end
  end

  list
end