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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top