cevent.h

来自「可以实现对邮件的加密解密以及签名」· C头文件 代码 · 共 72 行

H
72
字号
/*____________________________________________________________________________
		Copyright (C) 2002 PGP Corporation
        All rights reserved.

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

#ifndef Included_CEvent_h	// [
#define Included_CEvent_h

#include "pgpClassesConfig.h"

_PGP_BEGIN

// Class CEvent

class CEvent
{
	NOT_COPYABLE(CEvent)

public:
	CEvent(EVENT_TYPE type = NotificationEvent, PGPBoolean state = FALSE);

	operator KEVENT&() {return mEvent;}
	operator const KEVENT&() const {return mEvent;}

	operator PKEVENT() {return &mEvent;}

	void	Wait(PGPBoolean alertable = FALSE);
	void	Wait(PGPBoolean alertable, LARGE_INTEGER timeout);
	void	Signal(KPRIORITY increment = IO_NO_INCREMENT, 
		PGPBoolean wait = FALSE);

private:
	KEVENT	mEvent;
};


// Class CEvent member functions

inline 
CEvent::CEvent(EVENT_TYPE type, PGPBoolean state)
{
	KeInitializeEvent(&mEvent, type, state);
}

inline 
void 
CEvent::Wait(PGPBoolean alertable)
{
	KeWaitForSingleObject(&mEvent, Executive, KernelMode, alertable, NULL);
}

inline 
void 
CEvent::Wait(PGPBoolean alertable, LARGE_INTEGER timeout)
{
	KeWaitForSingleObject(&mEvent, Executive, KernelMode, alertable, 
		&timeout);
}

inline 
void 
CEvent::Signal(KPRIORITY increment, PGPBoolean wait)
{
	KeSetEvent(&mEvent, increment, wait);
}

_PGP_END

#endif	// ] Included_CEvent_h

⌨️ 快捷键说明

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