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
776 B
38 lines
776 B
//***************************************************************************
|
|
//
|
|
// Copyright © Microsoft Corporation. All rights reserved.
|
|
//
|
|
// LockWrap.h
|
|
//
|
|
// Purpose: Wrapper class for critical sections
|
|
//
|
|
//***************************************************************************
|
|
|
|
#include "stllock.h"
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif
|
|
|
|
// You use this class by passing via the constructor the name of the
|
|
// critical section you want to lock. When the CLockWrapper goes
|
|
// out of scope it will unlock itself.
|
|
class CLockWrapper
|
|
{
|
|
public:
|
|
CLockWrapper(CCritSec &cs)
|
|
{
|
|
m_pCS = &cs;
|
|
|
|
m_pCS->Enter();
|
|
}
|
|
|
|
~CLockWrapper()
|
|
{
|
|
m_pCS->Leave();
|
|
}
|
|
|
|
protected:
|
|
CCritSec *m_pCS;
|
|
};
|
|
|