ReactOS  0.4.12-dev-51-ge94618b
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 208 of file atlbase.h.

Constructor & Destructor Documentation

◆ CComCritSecLock()

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

Definition at line 214 of file atlbase.h.

214  : m_cs(cs)
215  {
216  HRESULT hResult;
217 
218  m_bLocked = false;
219  if (bInitialLock)
220  {
221  hResult = Lock();
222  if (FAILED(hResult))
223  {
224  ATLASSERT(false);
225  }
226  }
227  }
#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:235

◆ ~CComCritSecLock()

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

Definition at line 229 of file atlbase.h.

230  {
231  if (m_bLocked)
232  Unlock();
233  }

Member Function Documentation

◆ Lock()

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

Definition at line 235 of file atlbase.h.

236  {
237  HRESULT hResult;
238 
240  hResult = m_cs.Lock();
241  if (FAILED(hResult))
242  return hResult;
243  m_bLocked = true;
244 
245  return S_OK;
246  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59

◆ Unlock()

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

Definition at line 248 of file atlbase.h.

249  {
250  HRESULT hResult;
251 
253  hResult = m_cs.Unlock();
254  if (FAILED(hResult))
255  {
256  ATLASSERT(false);
257  }
258  m_bLocked = false;
259  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
LONG HRESULT
Definition: typedefs.h:77

Member Data Documentation

◆ m_bLocked

template<class TLock>
bool ATL::CComCritSecLock< TLock >::m_bLocked
private

Definition at line 211 of file atlbase.h.

◆ m_cs

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

Definition at line 212 of file atlbase.h.


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