Beispiel #1
0
        static void __Main(string[] args)
        {
            string file = @"/home/user/Desktop/lock2";

            FileMutex mutex = new FileMutex(file);

            Console.WriteLine("Trying to obtain exclusive lock...");

            mutex.Wait(1000 * 5);
            Console.WriteLine("exclusive lock is obtained...");

            Console.WriteLine("Press 'Enter' to release lock.");
            Console.ReadLine();

            mutex.Release();
            Console.WriteLine("Lock is released.");

            Console.ReadLine();
            Console.WriteLine("Press 'Enter' to exit.");
        }
Beispiel #2
0
        static void __Main(string[] args)
        {
            string file = @"/home/user/Desktop/krok/lock2";

            FileMutex mutex = new FileMutex(file);
            Console.WriteLine("Trying to obtain exclusive lock...");

            mutex.Wait(1000 * 5);
            Console.WriteLine("exclusive lock is obtained...");

            Console.WriteLine("Press 'Enter' to release lock.");
            Console.ReadLine();

            mutex.Release();
            Console.WriteLine("Lock is released.");

            Console.ReadLine();
            Console.WriteLine("Press 'Enter' to exit.");
        }