private static Mutex mutex = new Mutex();
public static void Main(string[] args)
for (int i = 1; i <= 5; i++)
Thread threadObject = new Thread(MutexDemo)
Console.WriteLine(Thread.CurrentThread.Name + " Wants to Enter Critical Section for processing");
Console.WriteLine("Success: " + Thread.CurrentThread.Name + " is processing now");
Console.WriteLine("Exit: " + Thread.CurrentThread.Name + " is completed !");
Console.WriteLine(Thread.CurrentThread.Name + " has released the mutex");
Console.WriteLine(Thread.CurrentThread.Name + " will not acquire the mutex");