How to check if Thread finished execution How to check if Thread finished execution multithreading multithreading

How to check if Thread finished execution


Use the Thread.IsAlive flag. This is to give the thread status.


For a thread you have the myThread.IsAlive property. It is false if the thread method returned or the thread was aborted.


You could fire an event from your thread when it finishes and subscribe to that.

Alternatively you can call Thread.Join() without any arguments:

Blocks the calling thread until a thread terminates, while continuing to perform standard COM and SendMessage pumping.

Thread.Join(1) will:

Blocks the calling thread until a thread terminates or the specified time elapses, while continuing to perform standard COM and SendMessage pumping.

In this case the specified time is 1 millisecond.