Foreground Thread Sleep : Thread Sleep : Thread C# Examples


C# Examples » Thread » Thread Sleep »

 

Foreground Thread Sleep









    
using  System;
using  System.Threading;

public  class  MainClass
{
        private  static  void  MyFunction()  {
                Thread.Sleep(  5000  );
                Console.WriteLine(  "Exiting  extra  thread"  );
        }

        static  void  Main()  {
                Thread  thread1  =  new  Thread(  new  ThreadStart(MyFunction)  );

                thread1.Start();

                Console.WriteLine(  "Exiting  main  thread"  );
        }
}
    
   
  
   



Output

Exiting main thread
Exiting extra thread


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Thread
» Thread Sleep