class MultipleMan::ChannelMaintenance::GC::SweepCommand

Attributes

queue[R]
reaper[R]

Public Class Methods

new(queue, reaper) click to toggle source
# File lib/multiple_man/channel_maintenance/gc.rb, line 84
def initialize(queue, reaper)
  @queue = queue
  @reaper = reaper
end

Public Instance Methods

execute(channels_by_thread) click to toggle source
# File lib/multiple_man/channel_maintenance/gc.rb, line 89
def execute(channels_by_thread)
  channels_by_thread.each do |thread_id, channels|
    thing = ObjectSpace._id2ref(thread_id) rescue nil
    next if thing.kind_of?(Thread) && thing.alive?

    channels.each {|c| reaper.push(c)}
    queue << RemoveCommand.new(thread_id)
  end
end