📄 jpgmisc.c
字号:
/*
* Project Name JPEG DRIVER IN WINCE
* Copyright 2007 Samsung Electronics Co, Ltd. All Rights 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 JPEG driver.
*
* @name JPEG DRIVER MODULE Module (JPGMisc.c)
* @author Jiyoung Shin (idon.shin@samsung.com)
* @date 28-03-07
*/
#include <windows.h>
#include <pmplatform.h>
//#define DEBUG 1
static HANDLE hMutex;
/*----------------------------------------------------------------------------
*Function: CreateJPGmutex
*Implementation Notes: Create Mutex handle
-----------------------------------------------------------------------------*/
HANDLE CreateJPGmutex(void)
{
hMutex = CreateMutex( NULL, // default security attributes
FALSE, // initially not owned
NULL); // unnamed mutex
return hMutex;
}
/*----------------------------------------------------------------------------
*Function: LockJPGMutex
*Implementation Notes: lock mutex
-----------------------------------------------------------------------------*/
DWORD LockJPGMutex(void)
{
DWORD Status;
Status = WaitForSingleObject(hMutex, INFINITE);
if(Status == WAIT_OBJECT_0)
{
Status = TRUE;
}
else
{
Status = GetLastError();
RETAILMSG(1,(TEXT("DD::MUTEX LOCK ERROR : %d\r\n"),Status));
Status = FALSE;
}
return Status;
}
/*----------------------------------------------------------------------------
*Function: UnlockJPGMutex
*Implementation Notes: unlock mutex
-----------------------------------------------------------------------------*/
DWORD UnlockJPGMutex(void)
{
DWORD Status;
Status = ReleaseMutex(hMutex);
if(Status != TRUE)
{
Status = GetLastError();
RETAILMSG(1,(TEXT("DD::MUTEX UNLOCK ERROR : %d\r\n"),Status));
}
return Status;
}
/*----------------------------------------------------------------------------
*Function: DeleteJPGMutex
*Implementation Notes: delete mutex handle
-----------------------------------------------------------------------------*/
void DeleteJPGMutex(void)
{
if (hMutex == NULL)
return;
CloseHandle(hMutex);
}
/*----------------------------------------------------------------------------
*Function: printD
*Parameters: fmt :
*Implementation Notes: Debug print
-----------------------------------------------------------------------------*/
void printD(char* fmt, ...)
{
#ifdef DEBUG
char str[512];
vsprintf(str, fmt, (char *)(&fmt+1));
printf(str);
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -