📄 mfcmutex.c
字号:
/*
* Project Name MFC DRIVER
* Copyright (c) Samsung Electronics
* All right reserved.
*
* This software is the confidential and proprietary information
* of Samsung Electronics ("Confidential Information").
* you shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with Samsung Electronics
*
* This file implements MUTEX to gurad MFC multi instance operation..
*
* @name MFC DRIVER MODULE Module (MfcMutex.c)
* @author Shija P S (p.s.shija@samsung.com)
*/
#include <windows.h>
//#include "MfcConfig.h"
#include "MfcMutex.h"
#define MUTEX_TIMEOUT 5000
static HANDLE hMutex = NULL;
BOOL MFC_Mutex_Create(void)
{
hMutex = CreateMutex( NULL, // default security attributes
FALSE, // initially not owned
NULL); // unnamed mutex
if (hMutex == NULL)
return FALSE;
return TRUE;
}
void MFC_Mutex_Delete(void)
{
if (hMutex == NULL)
return;
CloseHandle(hMutex);
}
BOOL MFC_Mutex_Lock(void)
{
DWORD status;
if (hMutex == NULL)
return FALSE;
status = WaitForSingleObject(hMutex, /*MUTEX_TIMEOUT*/ INFINITE);
if(status != WAIT_OBJECT_0)
return FALSE;
return TRUE;
}
BOOL MFC_Mutex_Release(void)
{
DWORD status;
if (hMutex == NULL)
return FALSE;
status = ReleaseMutex(hMutex);
if(status != TRUE) {
}
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -