J
Jeroen
Hi all,
I've been trying to get my head around threading. Here's an example
from the book I'm reading:
/***************************/
Mutex m = null;
const string name = "xyz";
try
{
m = Mutex.OLpenExisting(name);
}
catch (WaitHandleCannotBeOpenedException)
{ }
if (m == null)
{
// POINT 'A'
m = new Mutex(true, name);
}
else
{
m.close();
return;
}
/*****************************/
This example can be used in the main method to prevent two instances
of the same application to be run.
Now, as a newbie to threading, it seems to me that theoretically two
threads might *both* get to "Point 'A'", correct?
Thanks, regards,
Jeroen
I've been trying to get my head around threading. Here's an example
from the book I'm reading:
/***************************/
Mutex m = null;
const string name = "xyz";
try
{
m = Mutex.OLpenExisting(name);
}
catch (WaitHandleCannotBeOpenedException)
{ }
if (m == null)
{
// POINT 'A'
m = new Mutex(true, name);
}
else
{
m.close();
return;
}
/*****************************/
This example can be used in the main method to prevent two instances
of the same application to be run.
Now, as a newbie to threading, it seems to me that theoretically two
threads might *both* get to "Point 'A'", correct?
Thanks, regards,
Jeroen