共用方式為


CComAutoCriticalSection 類別

CComAutoCriticalSection 提供方法來取得和釋放重要區段物件的擁有權。

語法

class CComAutoCriticalSection : public CComCriticalSection

成員

公用建構函式

名稱 描述
CComAutoCriticalSection::CComAutoCriticalSection 建構函式。
CComAutoCriticalSection::~CComAutoCriticalSection 解構函式。

備註

CComAutoCriticalSection類似于 CComCriticalSection 類別 ,不同之處在于 CComAutoCriticalSection 會自動初始化建構函式中的重要區段物件。

一般而言,您會透過 typedef 名稱 AutoCriticalSection 來使用 CComAutoCriticalSection 。 此名稱會在使用 CComMultiThreadModel 參考 CComAutoCriticalSection

Init使用這個類別時,無法使用 CComCriticalSection 的 和 Term 方法

繼承階層架構

CComCriticalSection

CComAutoCriticalSection

需求

標頭: atlcore.h

CComAutoCriticalSection::CComAutoCriticalSection

建構函式。

CComAutoCriticalSection();

備註

呼叫 Win32 函式 InitializeCriticalSection ,以初始化重要區段物件。

CComAutoCriticalSection::~CComAutoCriticalSection

解構函式。

~CComAutoCriticalSection() throw();

備註

解構函式會呼叫 DeleteCriticalSection ,它會釋放重要區段物件所使用的所有系統資源。

另請參閱

CComFakeCriticalSection 類別
類別概觀
CComCriticalSection 類別