Hi I am trying to use Semaphore in my application. I have declared like this.
class MyThread
{
public Thread Thrd;
static Semaphore sem = new Semaphore(2, 2);
public MyThread(string name)
{
Thrd = new Thread(this.Run);
Thrd.Name = name;
Thrd.Start();
}
}
But I am not able to compile It's giving me this error:
The type or namespace name 'Semaphore' could not be found
(are you missing a using directive or an assembly reference?)
But I have already added the namespace using System.Threading; I am able to using Mutex.
May be what was I am missing. There is any other reference need to add.? I am using VS 2010. Framework 4.0