Class: MultipleMan::ChannelMaintenance::GC::SweepCommand
- Inherits:
-
Object
- Object
- MultipleMan::ChannelMaintenance::GC::SweepCommand
- Defined in:
- lib/multiple_man/channel_maintenance/gc.rb
Instance Attribute Summary collapse
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
-
#reaper ⇒ Object
readonly
Returns the value of attribute reaper.
Instance Method Summary collapse
- #execute(channels_by_thread) ⇒ Object
-
#initialize(queue, reaper) ⇒ SweepCommand
constructor
A new instance of SweepCommand.
Constructor Details
#initialize(queue, reaper) ⇒ SweepCommand
Returns a new instance of SweepCommand.
84 85 86 87 |
# File 'lib/multiple_man/channel_maintenance/gc.rb', line 84 def initialize(queue, reaper) @queue = queue @reaper = reaper end |
Instance Attribute Details
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
83 84 85 |
# File 'lib/multiple_man/channel_maintenance/gc.rb', line 83 def queue @queue end |
#reaper ⇒ Object (readonly)
Returns the value of attribute reaper.
83 84 85 |
# File 'lib/multiple_man/channel_maintenance/gc.rb', line 83 def reaper @reaper end |
Instance Method Details
#execute(channels_by_thread) ⇒ Object
89 90 91 92 93 94 95 96 97 |
# 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 |