📄 csemaphoreimpwin32.h
字号:
/*____________________________________________________________________________
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -