Threading with Mutex
using System;
using System.Collections;
using System.Threading;
class MainClass
{
public static ArrayList MyList = new ArrayList();
private static Mutex MyMutex = new Mutex(false, "MyMutex");
static void Main(string[] args)
{
Thread ThreadOne = new Thread(new ThreadStart(MutexExample));
ThreadOne.Start();
}
protected static void MutexExample()
{
MyMutex.WaitOne();
MyList.Add(" a value");
MyMutex.ReleaseMutex();
}
}
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
|