CComAutoCriticalSection 類別
CComAutoCriticalSection
提供方法來取得和釋放重要區段物件的擁有權。
語法
class CComAutoCriticalSection : public CComCriticalSection
成員
公用建構函式
名稱 | 描述 |
---|---|
CComAutoCriticalSection::CComAutoCriticalSection | 建構函式。 |
CComAutoCriticalSection::~CComAutoCriticalSection | 解構函式。 |
備註
CComAutoCriticalSection
類似于 CComCriticalSection 類別 ,不同之處在于 CComAutoCriticalSection
會自動初始化建構函式中的重要區段物件。
一般而言,您會透過 typedef
名稱 AutoCriticalSection 來使用 CComAutoCriticalSection
。 此名稱會在使用 CComMultiThreadModel 時 參考 CComAutoCriticalSection
。
Init
使用這個類別時,無法使用 CComCriticalSection 的 和 Term
方法 。
繼承階層架構
CComAutoCriticalSection
需求
標頭: atlcore.h
CComAutoCriticalSection::CComAutoCriticalSection
建構函式。
CComAutoCriticalSection();
備註
呼叫 Win32 函式 InitializeCriticalSection ,以初始化重要區段物件。
CComAutoCriticalSection::~CComAutoCriticalSection
解構函式。
~CComAutoCriticalSection() throw();
備註
解構函式會呼叫 DeleteCriticalSection ,它會釋放重要區段物件所使用的所有系統資源。
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應