J
James
below is a sample code
i read a list of machines and use ThreadPool.QueueUserWorkItem to thread
each machine using a timer. If the machine is not pingable, i wish to kill
the thread that checks the ping function, so that the next poll will not run
again.
Any advice ?
***********************************************************************
Private Sub OnTimerElapsed(ByVal sender As Object, ByVal e As
System.timers.ElapsedEventArgs)
For Each computer In Me.machines
m_utl = New utility(m_kbhotfix, m_domain, m_ntid, m_pwd)
ThreadPool.QueueUserWorkItem(AddressOf m_utl.pollmachines, computer)
Next
end sub
public class utility
Public Sub pollmachines(ByVal state As Object)
computer = CType(state, String)
If Not pingmachine(computer) Then
'how to kill the thread that does the last
pollmachines
End If
end sub
public function pingmachine as boolean
pingmachine =false
end function
end class
i read a list of machines and use ThreadPool.QueueUserWorkItem to thread
each machine using a timer. If the machine is not pingable, i wish to kill
the thread that checks the ping function, so that the next poll will not run
again.
Any advice ?
***********************************************************************
Private Sub OnTimerElapsed(ByVal sender As Object, ByVal e As
System.timers.ElapsedEventArgs)
For Each computer In Me.machines
m_utl = New utility(m_kbhotfix, m_domain, m_ntid, m_pwd)
ThreadPool.QueueUserWorkItem(AddressOf m_utl.pollmachines, computer)
Next
end sub
public class utility
Public Sub pollmachines(ByVal state As Object)
computer = CType(state, String)
If Not pingmachine(computer) Then
'how to kill the thread that does the last
pollmachines
End If
end sub
public function pingmachine as boolean
pingmachine =false
end function
end class