Small tweaks to the thread code, add an update method

git-svn-id: file:///home/svn/framework3/trunk@11011 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-11-12 17:28:40 +00:00
parent 9df4c2bccf
commit 29073a519a
2 changed files with 25 additions and 1 deletions

View File

@ -91,6 +91,30 @@ class ThreadManager < Array
t
end
#
# Updates an existing thread
#
def update(ut, name, crit)
ti = nil
self.each_index do |i|
tt = self[i]
next if not tt
if ut.__id__ == tt.__id__
ti = i
break
end
end
t = self[ti]
if not t
raise RuntimeError, "Thread not found"
end
t[:tm_name] = name
t[:tm_crit] = crit
t
end
#
# Kills a thread by index
#

View File

@ -122,7 +122,7 @@ module StreamAbstraction
protected
def monitor_rsock
self.monitor_thread = Rex::ThreadFactory.spawn("StreamMonitorRemote-#{self.peerinfo}", false) {
self.monitor_thread = Rex::ThreadFactory.spawn("StreamMonitorRemote", false) {
loop do
closed = false
buf = nil