csemaphoreimpwin32.h
来自「可以实现对邮件的加密解密以及签名」· C头文件 代码 · 共 72 行
H
72 行
/*____________________________________________________________________________
Copyright (C) 2002 PGP Corporation
All rights reserved.
$Id: CSemaphoreImpWin32.h,v 1.3 2002/08/06 20:10:46 dallen Exp $
____________________________________________________________________________*/
#ifndef Included_CSemaphoreImpWin32_h // [
#define Included_CSemaphoreImpWin32_h
#include "pgpClassesConfig.h"
#include "CSemaphoreImp.h"
_PGP_BEGIN
// Class CSemaphoreImpWin32
class CSemaphoreImpWin32 : public CSemaphoreImp
{
friend class CPFLImpFactoryWin32;
private:
CSemaphoreImpWin32();
~CSemaphoreImpWin32();
PGPUInt32 Wait(PGPInt32 msTimeout);
void Signal(PGPUInt32 count);
private:
HANDLE mSemHandle;
};
// Class CSemaphoreImpWin32 member functions
inline
CSemaphoreImpWin32::CSemaphoreImpWin32()
{
mSemHandle = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL);
if (IsNull(mSemHandle))
THROW_ERRORS(kPGPError_SyncObjOpFailed, GetLastError());
}
inline
CSemaphoreImpWin32::~CSemaphoreImpWin32()
{
CloseHandle(mSemHandle);
mSemHandle = NULL;
}
inline
PGPUInt32
CSemaphoreImpWin32::Wait(PGPInt32 msTimeout)
{
if (msTimeout == CSemaphore::InfiniteTimeout)
msTimeout = INFINITE;
return WaitForSingleObjectEx(mSemHandle, msTimeout, FALSE);
}
inline
void
CSemaphoreImpWin32::Signal(PGPUInt32 count)
{
ReleaseSemaphore(mSemHandle, count, NULL);
}
_PGP_END
#endif // ] Included_CSemaphoreImpWin32_h
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?