Skip to content

Latest commit

 

History

History
78 lines (44 loc) · 3.09 KB

cautolock.md

File metadata and controls

78 lines (44 loc) · 3.09 KB
description ms.assetid title ms.topic ms.date topic_type api_name api_type api_location ms.custom
The CAutoLock class holds a critical section for the scope of a code block.
8013b3a7-297b-4cf8-8107-4cee1fc12b56
CAutoLock class (Wxutil.h)
reference
4/26/2023
APIRef
kbSyntax
CAutoLock
COM
Strmbase.lib
Strmbase.dll
Strmbasd.lib
Strmbasd.dll
UpdateFrequency5

CAutoLock class

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The CAutoLock class holds a critical section for the scope of a code block.

This class works in conjunction with the CCritSec class, which is a wrapper for critical section objects. The CAutoLock constructor locks the critical section, and the destructor unlocks it. By using a CAutoLock object as a local variable, you can lock a critical section with the guarantee that all code paths will unlock the critical section.

The following code example shows how to use this class:

CCritSec csMyLock;  // Critical section is not locked yet.
{
    CAutoLock cObjectLock(&csMyLock);  // Lock the critical section.

    // Protected section of code.     

} // Lock goes out of scope here.

The methods in this class are not designed to be overridden.

Protected Member Variables Description
m_pLock Critical section for this lock.
Public Methods Description
CAutoLock Constructor method. Locks the specified critical section object.
~CAutoLock Destructor method. Unlocks the critical section object.

Requirements

Requirement Value
Header
Wxutil.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)