using Mutex causing application to hang on Win XP X64
Posted
by Mohsan
on Stack Overflow
See other posts from Stack Overflow
or by Mohsan
Published on 2010-05-11T11:58:42Z
Indexed on
2010/05/11
12:24 UTC
Read the original article
Hit count: 323
hi.
I used the following code to verify the single instance of application. On Win XP X86 it is working fine, but on X64 after 3 to 4 minutes System generates StackOverflowException and causes the application to hang. after removing this check application is working fine..
Please tell me what should be the reason.
code is
static void Main()
{
bool instanceCountOne = false;
using (Mutex mtex = new Mutex(true, "AppName", out instanceCountOne))
{
if (instanceCountOne)
{
#if (DEBUG)
RunInDebugMode();
#else
RunInReleaseMode();
#endif
mtex.ReleaseMutex();
}
else
{
MessageBox.Show(
"An application instance is already running",
"App Name",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
}
}
it crashes when single instance of application is running.
© Stack Overflow or respective owner