Threads

J

Juan Carlos

Hi

How can I associate an event to a thread??? I need to know
exactly when a thread finish.

Is it possible???

Regards
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi Juan,

You can use asynchronous programming (BeginInvoke and EndInvoke) instead.
With these methods, you can supply a callback delegate which will be invoked
when the call is complete.

Or, you can write a thread procedure like this:

try
{
RunCore();
}
finally
{
OnCompleted();
}
 
S

Steve Tibbett

Juan Carlos said:
How can I associate an event to a thread??? I need to know
exactly when a thread finish.

If you want to wait for the thread to finish, Thread.Join is a nice easy way
(as long as you already know the thread is exiting).
 

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

Top