ReactOS 0.4.15-dev-7924-g5949c20
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 246 of file atlbase.h.

Constructor & Destructor Documentation

◆ CComCritSecLock()

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

Definition at line 252 of file atlbase.h.

252 : m_cs(cs)
253 {
254 HRESULT hResult;
255
256 m_bLocked = false;
257 if (bInitialLock)
258 {
259 hResult = Lock();
260 if (FAILED(hResult))
261 {
262 ATLASSERT(false);
263 }
264 }
265 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HRESULT Lock()
Definition: atlbase.h:273
#define cs
Definition: i386-dis.c:442
#define FAILED(hr)
Definition: intsafe.h:51

◆ ~CComCritSecLock()

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

Definition at line 267 of file atlbase.h.

268 {
269 if (m_bLocked)
270 Unlock();
271 }

Member Function Documentation

◆ Lock()

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

Definition at line 273 of file atlbase.h.

274 {
275 HRESULT hResult;
276
278 hResult = m_cs.Lock();
279 if (FAILED(hResult))
280 return hResult;
281 m_bLocked = true;
282
283 return S_OK;
284 }
#define S_OK
Definition: intsafe.h:52

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

◆ Unlock()

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

Definition at line 286 of file atlbase.h.

287 {
288 HRESULT hResult;
289
291 hResult = m_cs.Unlock();
292 if (FAILED(hResult))
293 {
294 ATLASSERT(false);
295 }
296 m_bLocked = false;
297 }

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: