共用方式為


CComMultiThreadModel Class

CComMultiThreadModel provides thread-safe methods for incrementing and decrementing the value of a variable.

class CComMultiThreadModel

Members

Public Typedefs

Name

Description

CComMultiThreadModel::AutoCriticalSection

References class CComAutoCriticalSection.

CComMultiThreadModel::CriticalSection

References class CComCriticalSection.

CComMultiThreadModel::ThreadModelNoCS

References class CComMultiThreadModelNoCS.

Public Methods

Name

Description

CComMultiThreadModel::Decrement

(Static) Decrements the value of the specified variable in a thread-safe manner.

CComMultiThreadModel::Increment

(Static) Increments the value of the specified variable in a thread-safe manner.

Remarks

Typically, you use CComMultiThreadModel through one of two typedef names, either CComObjectThreadModel or CComGlobalsThreadModel. The class referenced by each typedef depends on the threading model used, as shown in the following table:

typedef

Single threading

Apartment threading

Free threading

CComObjectThreadModel

S

S

M

CComGlobalsThreadModel

S

M

M

S=CComSingleThreadModel; M=CComMultiThreadModel

CComMultiThreadModel itself defines three typedef names. AutoCriticalSection and CriticalSection reference classes that provide methods for obtaining and releasing ownership of a critical section. ThreadModelNoCS references class CComMultiThreadModelNoCS.

Requirements

Header: atlbase.h

See Also

Reference

CComSingleThreadModel Class

CComAutoCriticalSection Class

CComCriticalSection Class

Other Resources

ATL Class Overview