using System; using System.Threading; class MainClass { public static void Main( string[] args ) { string mutexName = "MainClass"; Mutex m = new Mutex( false, mutexName ); for( ;; ) { m.WaitOne( ); Console.WriteLine("Have Mutex"); Console.WriteLine("Releasing"); m.ReleaseMutex( ); } } }
Have Mutex Releasing Have Mutex Releasing ... ... ^CTerminate batch job (Y/N)? n