Hi Guys,
I'm having a bizarre problem here with mutexes.
If I have the following code in a page (note that it never releases the
mutex!), then load the page twice, in 2 seperate browsers, I do not get
a mutex lock.
Any ideas? I'm trying to get a globally accessible mutex. Is using the
Application[] object wrong somehow?
In Global.asax:
void Application_Start(object sender, EventArgs e)
{
Application["AppMutex"] = new System.Threading.Mutex();
}
In my page:-
protected void Page_Load(object sender, EventArgs e)
{
if (!((System.Threading.Mutex)Application["AppMutex"]).WaitOne())
Label1.Text = "Cannot lock mutex";
else
Label1.Text = "Mutex locked ok";
}