3 using System.Threading;
6 public static void Main() {
7 // it will actually return 0 only if the thread finishes executing
8 Environment.ExitCode = 1;
9 Thread thr=new Thread(new ThreadStart(foo.thread));
12 Console.WriteLine("Main thread returns");
15 public static void thread() {
16 Console.WriteLine("Thread running");
18 Console.WriteLine("Thread running");
20 Console.WriteLine("Thread running");
22 Console.WriteLine("Thread running");
24 Console.WriteLine("Thread running");
25 Environment.ExitCode = 0;