ReactOS  0.4.15-dev-4603-gb922b6d
ATL::CComCritSecLock< TLock > Class Template Reference

#include <atlbase.h>

Public Member Functions

 CComCritSecLock (TLock &cs, bool bInitialLock=true)
 
 ~CComCritSecLock ()
 
HRESULT Lock ()
 
void Unlock ()
 

Private Attributes

bool m_bLocked
 
TLock & m_cs
 

Detailed Description

template<class TLock>
class ATL::CComCritSecLock< TLock >

Definition at line 197 of file atlbase.h.

Constructor & Destructor Documentation

◆ CComCritSecLock()

template<class TLock>
ATL::CComCritSecLock< TLock >::CComCritSecLock ( TLock &  cs,
bool  bInitialLock = true 
)
inline

Definition at line 203 of file atlbase.h.

203  : m_cs(cs)
204  {
205  HRESULT hResult;
206 
207  m_bLocked = false;
208  if (bInitialLock)
209  {
210  hResult = Lock();
211  if (FAILED(hResult))
212  {
213  ATLASSERT(false);
214  }
215  }
216  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
uint32_t cs
Definition: isohybrid.c:75
LONG HRESULT
Definition: typedefs.h:79
HRESULT Lock()
Definition: atlbase.h:224

◆ ~CComCritSecLock()

template<class TLock>
ATL::CComCritSecLock< TLock >::~CComCritSecLock ( )
inline

Definition at line 218 of file atlbase.h.

219  {
220  if (m_bLocked)
221  Unlock();
222  }

Member Function Documentation

◆ Lock()

template<class TLock>
HRESULT ATL::CComCritSecLock< TLock >::Lock ( void  )
inline

Definition at line 224 of file atlbase.h.

225  {
226  HRESULT hResult;
227 
229  hResult = m_cs.Lock();
230  if (FAILED(hResult))
231  return hResult;
232  m_bLocked = true;
233 
234  return S_OK;
235  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:52

Referenced by ATL::CComCritSecLock< TLock >::CComCritSecLock().

◆ Unlock()

template<class TLock>
void ATL::CComCritSecLock< TLock >::Unlock ( void  )
inline

Definition at line 237 of file atlbase.h.

238  {
239  HRESULT hResult;
240 
242  hResult = m_cs.Unlock();
243  if (FAILED(hResult))
244  {
245  ATLASSERT(false);
246  }
247  m_bLocked = false;
248  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
LONG HRESULT
Definition: typedefs.h:79

Referenced by ATL::CComCritSecLock< TLock >::~CComCritSecLock().

Member Data Documentation

◆ m_bLocked

◆ m_cs

template<class TLock>
TLock& ATL::CComCritSecLock< TLock >::m_cs
private

The documentation for this class was generated from the following file: