mutex.h

来自「This is a source code for Ethernet Drive」· C头文件 代码 · 共 53 行

H
53
字号
// Mutex.h: interface for the CMutex class.
//
//////////////////////////////////////////////////////////////////////
//========================================================================
// Class Name	: CMutex
// Purpose		: 
// Autor		: Richard Chuang
// Email		: 
// Description	: 
// Reference    : 
// Copyright    : Copyright (c) 2000-2007 Davicom Inc.  All rights reserved.
// -----------------------------------------------------------------------
// Version		: 1.0.0.0
// Update       : 2007-10-23
// Modified		: Richard Chung
// Description	: 
// -----------------------------------------------------------------------
// How to use: 
//  
#if !defined(_DAVICOM_MUTEX_H_)
#define _DAVICOM_MUTEX_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "stdafx.h"

#define	WAIT_FOREVER	((DWORD)-1)
//#ifdef	IMPL_NO_CRITICAL_SECTION
//#error no critical section
#define IMPL_NO_CRITICAL_SECTION 1

class CMutex  
{
public:
	CMutex();
	virtual ~CMutex();
	int	TryLock(void);
	int	Lock(DWORD uMicroSeconds=WAIT_FOREVER, DWORD uMicroPeriod=1000);
	void Release(void);

protected:

#ifdef	IMPL_NO_CRITICAL_SECTION
	NDIS_SPIN_LOCK		m_SpinLock;
	int					m_nValue;
#else
	CRITICAL_SECTION	m_Critical;
#endif
};

#endif // !defined(_DAVICOM_MUTEX_H_)

⌨️ 快捷键说明

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