Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
572 B

#ifndef PASSPORTLOCK_HPP
#define PASSPORTLOCK_HPP
#include <windows.h>
#include <winbase.h>
class PassportLock
{
public:
PassportLock(DWORD dwSpinCount = 4000);
void acquire();
void release();
~PassportLock();
private:
CRITICAL_SECTION mLock;
};
class PassportLockGlobal
{
public:
PassportLockGlobal(CRITICAL_SECTION &critSec)
: mLock(critSec)
{
EnterCriticalSection(&mLock);
}
~PassportLockGlobal()
{
LeaveCriticalSection(&mLock);
}
private:
CRITICAL_SECTION &mLock;
};
#endif // !PASSPORTLOCK_HPP