⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csemaphoreimpdrvnt.h

📁 PGP8.0源码 请认真阅读您的文件包然后写出其具体功能
💻 H
字号:
/*____________________________________________________________________________
		Copyright (C) 2002 PGP Corporation
        All rights reserved.

        $Id: CSemaphoreImpDrvNT.h,v 1.3 2002/08/06 20:10:51 dallen Exp $
____________________________________________________________________________*/

#ifndef Included_CSemaphoreImpDrvNT_h	// [
#define Included_CSemaphoreImpDrvNT_h

#include "pgpClassesConfig.h"
#include "CSemaphoreImp.h"

_USING_PGP

// Class CSemaphoreImpDrvNT

class CSemaphoreImpDrvNT : public CSemaphoreImp
{
	friend class CPFLImpFactoryDrvNT;

private:
	CSemaphoreImpDrvNT();

public:
	~CSemaphoreImpDrvNT();

	PGPUInt32	Wait(PGPInt32 msTimeout);
	void		Signal(PGPUInt32 count);

private:
	KSEMAPHORE	mSemaphore;
};


// Class CSemaphoreImpDrvNT member functions

inline 
CSemaphoreImpDrvNT::CSemaphoreImpDrvNT()
{
	KeInitializeSemaphore(&mSemaphore, 0, 10000);
}

inline 
CSemaphoreImpDrvNT::~CSemaphoreImpDrvNT()
{
}

inline 
PGPUInt32 
CSemaphoreImpDrvNT::Wait(PGPInt32 msTimeout)
{
	LARGE_INTEGER	wait	= RtlConvertLongToLargeInteger(0 - 
		static_cast<PGPInt32>(msTimeout * PFLConstants::kHundredNsPerMs));

	if (msTimeout == CMutex::InfiniteTimeout)
	{
		return KeWaitForSingleObject(&mSemaphore, Executive, KernelMode, 
			FALSE, NULL);
	}
	else
	{
		return KeWaitForSingleObject(&mSemaphore, Executive, KernelMode, 
			FALSE, &wait);
	}
}

inline 
void 
CSemaphoreImpDrvNT::Signal(PGPUInt32 count)
{
	KeReleaseSemaphore(&mSemaphore, 0, count, FALSE);
}

#endif	// ] Included_CSemaphoreImpDrvNT_h

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -