J
John paul coder
Guest
Hello All,
To create a single instance of my desktop windows application (windows security application), I am using Mutex. Using CreateMutex, getting the handle of the mutex object. If the handle is NULL, returning from the application.
Below is the code snippet:
//Single instance
HANDLE hMutex = CreateMutex(NULL, FALSE, TEXT("SecurityJob"));
DWORD dwerror_code = GetLastError();
if (NULL == hMutex || ERROR_ALREADY_EXISTS == dwerror_code)
{
return 0;
}
Here, why I shouldn't use Critical Section or other synchronization technique?
Is it because each instance of the application will be treated as one process?
What will happen if i use Critical Section?
Regards,
Continue reading...
To create a single instance of my desktop windows application (windows security application), I am using Mutex. Using CreateMutex, getting the handle of the mutex object. If the handle is NULL, returning from the application.
Below is the code snippet:
//Single instance
HANDLE hMutex = CreateMutex(NULL, FALSE, TEXT("SecurityJob"));
DWORD dwerror_code = GetLastError();
if (NULL == hMutex || ERROR_ALREADY_EXISTS == dwerror_code)
{
return 0;
}
Here, why I shouldn't use Critical Section or other synchronization technique?
Is it because each instance of the application will be treated as one process?
What will happen if i use Critical Section?
Regards,
Continue reading...