lockablelist.h
来自「vc环境下的pgp源码」· C头文件 代码 · 共 80 行
H
80 行
//////////////////////////////////////////////////////////////////////////////
// LockableList.h
//
// Declaration and definition of class LockableList.
//////////////////////////////////////////////////////////////////////////////
// $Id: LockableList.h,v 1.3 1998/12/14 18:59:40 nryan Exp $
// Copyright (C) 1998 by Network Associates, Inc.
// All rights reserved.
#ifndef Included_Lockable_h // [
#define Included_Lockable_h
#include "DualErr.h"
/////////////////////
// Class LockableList
/////////////////////
template <class T> class LockableList : public KList<T>
{
public:
LockableList();
~LockableList();
void PublicLock();
void PublicUnlock();
private:
KIRQL mOldIrql;
KSPIN_LOCK mSpinLock;
};
////////////////////////////////////////////////////
// Class LockableList inline public member functions
////////////////////////////////////////////////////
// The LockableList constructor.
template <class T>
inline
LockableList<T>::LockableList() : KList<T>()
{
}
// The LockableList destructor.
template <class T>
inline
LockableList<T>::~LockableList()
{
}
// PublicLock locks the list.
template <class T>
void
LockableList<T>::PublicLock()
{
KIRQL oldIrql;
KeAcquireSpinLock(&mSpinLock, &oldIrql);
mOldIrql = oldIrql;
}
// PublicUnlock unlocks the list.
template <class T>
void
LockableList<T>::PublicUnlock()
{
KeReleaseSpinLock(&mSpinLock, mOldIrql);
}
#endif // ] Included_Lockable_h
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?