কম্পিউটার

C# এ Mutex ক্লাস কি?


C#-এ Mutex ক্লাস হল একটি সিঙ্ক্রোনাইজেশন প্রিমিটিভ যা ইন্টারপ্রসেস সিঙ্ক্রোনাইজেশনের জন্যও ব্যবহার করা যেতে পারে।

আসুন দেখি কিভাবে একটি নতুন Mutex তৈরি করা যায়।

private static Mutex m = new Mutex();

আসুন এখন দেখি কিভাবে একটি বুলিয়ান মান সহ Mutex ক্লাসের একটি নতুন উদাহরণ শুরু করা যায়।

private static Mutex m = new Mutex(true);

এখন দেখা যাক কিভাবে একটি বুলিয়ান মান এবং Mutex এর নামের সাথে Mutex ক্লাসের একটি নতুন ইনস্ট্যান্স শুরু করা যায়।

উদাহরণ

using System;
using System.Threading;

public class Demo {
   public static void Main() {
      Mutex mt = new Mutex(false, "NewMutex");
      Console.WriteLine("Waiting for the Mutex.");
      mt.WaitOne();
      Console.WriteLine("Owner of the mutex. " + "ENTER is to be pressed to release the mutexand          exit.");
      Console.ReadLine();
      mt.ReleaseMutex();
   }
}

আউটপুট

Waiting for the Mutex.
Owner of the mutex. ENTER is to be pressed to release the mutex and exit.

  1. C# এ হ্যাশটেবল ক্লাসের মান সম্পত্তি কি?

  2. C# এ ক্লাস কি কি?

  3. C# এ BitArray ক্লাসের কাউন্ট সম্পত্তি কি?

  4. C# এ SortedList ক্লাসের ক্যাপাসিটি প্রপার্টি কি?