Multi Threading question

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

Hi,
Hopefully i can make myself clear :-)

If I have an array if objects and I loop through the array and call a method
of each object in a
different thread, can I use the same handler when the thread completes or
will this cause problems?

Something like:

Private ProcessResultHandler As AsyncCallback = AddressOf ProcessResults


For i = 0 To ComputerArray.GetUpperBound(0)
sfh = AddressOf ComputerArray(i).UninstallAgent
sfh.BeginInvoke(ProcessResultHandler, Nothing)
Next i

Public Sub ProcessResults()
DoSomething()
End Sub

Thanks!
Dan
 
Am 05.03.2010 14:09, schrieb Dan:
If I have an array if objects and I loop through the array and call a method
of each object in a
different thread, can I use the same handler when the thread completes or
will this cause problems?

Something like:

Private ProcessResultHandler As AsyncCallback = AddressOf ProcessResults


For i = 0 To ComputerArray.GetUpperBound(0)
sfh = AddressOf ComputerArray(i).UninstallAgent
sfh.BeginInvoke(ProcessResultHandler, Nothing)
Next i

Public Sub ProcessResults()
DoSomething()
End Sub

This should work.
 
Back
Top