Threading question

  • Thread starter Thread starter Nikolay Petrov
  • Start date Start date
N

Nikolay Petrov

How ti dynamicaly create threads and do things on based their status.

I know how to create thread using this method:
--
Dim Thread1 As New System.Threading.Thread(AddressOf SomeSub)
Thread1.Start
--

Let's say that SomeSub do some things, calcs some data or something. How
would I know that it has finished it operation, so my other functions or
subs can work with processed data?


If I call the fallowing Sub multiple times, how would I know which exactly
thread is returning processed data?
 
Nikolay Petrov said:
How ti dynamicaly create threads and do things on based
their status.

I know how to create thread using this method:
--
Dim Thread1 As New System.Threading.Thread(AddressOf SomeSub)
Thread1.Start
--

Let's say that SomeSub do some things, calcs some data or
something. How would I know that it has finished it operation,
so my other functions or subs can work with processed data?

You can check the thread's 'IsAlive' property.

If you need a notification when a thread finishes its work, take a look at
the 'IAsyncResult' interface, there are samples in the documentation.
 
Back
Top