Foreground Thread Sleep : Thread Sleep « Thread « C# / CSharp Tutorial






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" );
    }
}
Exiting main thread
Exiting extra thread








20.3.Thread Sleep
20.3.1.Foreground Thread Sleep
20.3.2.Putting a Thread to Sleep
20.3.3.Thread.Sleep