ReactOS  0.4.13-dev-242-g611e6d7
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 196 of file atlbase.h.

Constructor & Destructor Documentation

◆ CComCritSecLock()

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

Definition at line 202 of file atlbase.h.

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

◆ ~CComCritSecLock()

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

Definition at line 217 of file atlbase.h.

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

Member Function Documentation

◆ Lock()

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

Definition at line 223 of file atlbase.h.

224  {
225  HRESULT hResult;
226 
228  hResult = m_cs.Lock();
229  if (FAILED(hResult))
230  return hResult;
231  m_bLocked = true;
232 
233  return S_OK;
234  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59

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

◆ Unlock()

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

Definition at line 236 of file atlbase.h.

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

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: