Threading question

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?
 
H

Herfried K. Wagner [MVP]

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.
 

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

Similar Threads


Top