lmutexsemaphore.h

来自「vc环境下的pgp源码」· C头文件 代码 · 共 40 行

H
40
字号
/*____________________________________________________________________________
	Copyright (C) 1996-1999 Network Associates, Inc.
	All rights reserved.

	$Id: LMutexSemaphore.h,v 1.4 1999/03/10 02:44:02 heller Exp $
____________________________________________________________________________*/
#ifndef LMUTEXSEMAPHORE_H
#define LMUTEXSEMAPHORE_H

#include "LSemaphore.h"

class LMutexSemaphore;

class LMutexSemaphore : public LSemaphore 
{
public:
					LMutexSemaphore(void);
					LMutexSemaphore(LMutexSemaphore &mutex)
						{	mMutex = mutex.mMutex;	}
	virtual			~LMutexSemaphore(void);
	
	inline virtual void		Signal(void);
	inline virtual short	Wait(long milliSeconds = semaphore_WaitForever);
private:
	HANDLE		mMutex;		// mutex handle for Win32 API calls
};

class StMutex : public LMutexSemaphore	// stack-based mutex
{
public:
				StMutex(LMutexSemaphore &mutex);
	virtual		~StMutex(void)
					{	mMutex.Signal();	}
private:
	LMutexSemaphore	&mMutex;
};

#endif

⌨️ 快捷键说明

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