A thread is nothing more than a process.

The C# .Net language has a powerful namespace which can be used for programming with Threads as well as Thread Synchronization in C# .Net programming. The name of the namespace is Sytem.Threading. The most important class inside this namespace for manipulating the threads is the C# .Net class Thread. It can run other thread in our application process.
Sample program on C# Multithreading - C# Tutorial:

The example it creates an additional C# .Net class Launcher. It has only one method, which output countdown in the console.

Code:
//Sample for C# tutorial on Multithreading using lock

    public void Coundown()
    {

        lock(this)
        {

            for(int i=4;i>=0;i--)
            {

                Console.WriteLine("{0} seconds to start",i);

            }

            Console.WriteLine("GO!!!!!");

        }

    }
There is a new keyword lock inside the above chunk of .Net C# tutorial code. This provides a mechanism for synchronizing the thread operation. It means at the same point of time only one thread can access to this method of created object. Unless the lock is released after completion of the code, the next routine or iteration cannot enter the block.

Last edited by shabbir; 18Feb2011 at 20:33.. Reason: Code blocks