Bogi Bogi -4 years ago 102
C# Question

How to check if Thread finished execution

I have following problem:

I want to check (C#) if a thread has finished execution, i.e. if the thread method has returned. What I do now is call

Thread.Join(1)
, but this gives a 1 ms delay. Is there any way to simply check if a thread has finished. Inspecting
Thread.ThreadState
just seems too cumbersome.

Answer Source

Why not Thread.IsAlive flag. This is to give the thread status.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download