new Mutex(true, "MutexExample", out ownsMutex)), ReleaseMutex : Mutex : Thread C# Source Code


Custom Search

C# Source Code » Thread » Mutex »

 

new Mutex(true, "MutexExample", out ownsMutex)), ReleaseMutex








    
 

using System;
using System.Threading;

class MainClass {
    public static void Main() {
        bool ownsMutex;
        using (Mutex mutex = new Mutex(true, "MutexExample", out ownsMutex)) {
            if (ownsMutex) {
                Console.ReadLine();
                mutex.ReleaseMutex();
            } else {
                Console.WriteLine("Another instance of this application " +
                    " already owns the mutex named MutexExample.");
            }
        }
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Thread
» Mutex