Partager via


CComAutoCriticalSection Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CComAutoCriticalSection Class.

CComAutoCriticalSection` provides methods for obtaining and releasing ownership of a critical section object.

Syntax

class CComAutoCriticalSection : public CComCriticalSection

Members

Public Constructors

Name Description
CComAutoCriticalSection::CComAutoCriticalSection The constructor.
CComAutoCriticalSection::~CComAutoCriticalSection The destructor.

Remarks

CComAutoCriticalSection is similar to class CComCriticalSection, except CComAutoCriticalSection automatically initializes the critical section object in the constructor.

Typically, you use CComAutoCriticalSection through the typedef name AutoCriticalSection. This name references CComAutoCriticalSection when CComMultiThreadModel is being used.

The Init and Term methods from CComCriticalSection are not available when using this class.

Inheritance Hierarchy

CComCriticalSection

CComAutoCriticalSection

Requirements

Header: atlcore.h

CComAutoCriticalSection::CComAutoCriticalSection

The constructor.

CComAutoCriticalSection();

Remarks

Calls the Win32 function InitializeCriticalSection, which initializes the critical section object.

CComAutoCriticalSection::~CComAutoCriticalSection

The destructor.

~CComAutoCriticalSection() throw();

Remarks

The destructor calls DeleteCriticalSection, which releases all system resources used by the critical section object.

See Also

CComFakeCriticalSection Class
Class Overview
CComCriticalSection Class