isAlive and join()
Once started, a thread’s IsAlive property returns true, until the point where the thread ends. A thread ends when the delegate passed to the Thread’s constructor finishes executing. Once ended, a thread cannot restart.
You can wait for another thread to end by calling its Join method. Here’s an example:
Example
using System; using System.Threading; namespace ConsoleApplication1 { class Program { static void Main() { Thread t = new Thread(Go); // returns false because t(thread) not started Console.WriteLine(t.IsAlive); t.Start();// thread started // returns true because t(thread) is started Console.WriteLine(t.IsAlive); // this thread(main) will wait for other threads(t) to finish t.Join(); Console.WriteLine(t.IsAlive); // return false Console.WriteLine("Thread t has ended!"); Console.Read(); } static void Go() { for (int i = 0; i < 100; i++) Console.WriteLine(i); } } }