다음을 통해 공유


CriticalSection 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 CriticalSection Class.

Represents a critical section object.

Syntax

class CriticalSection;  

Members

Constructor

Name Description
CriticalSection::CriticalSection Constructor Initializes a synchronization object that is similar to a mutex object, but can be used by only the threads of a single process.
CriticalSection::~CriticalSection Destructor Deinitializes and destroys the current CriticalSection object.

Public Methods

Name Description
CriticalSection::TryLock Method Attempts to enter a critical section without blocking. If the call is successful, the calling thread takes ownership of the critical section.
CriticalSection::Lock Method Waits for ownership of the specified critical section object. The function returns when the calling thread is granted ownership.
CriticalSection::IsValid Method Indicates whether the current critical section is valid.

Protected Data Members

Name Description
CriticalSection::cs_ Data Member Declares a critical section data member.

Inheritance Hierarchy

CriticalSection

Requirements

Header: corewrappers.h

Namespace: Microsoft::WRL::Wrappers

See Also

Microsoft::WRL::Wrappers Namespace