共用方式為


CComSingleThreadModel Class

This class provides methods for incrementing and decrementing the value of a variable.

class CComSingleThreadModel

Members

Public Typedefs

Name

Description

CComSingleThreadModel::AutoCriticalSection

References class CComFakeCriticalSection.

CComSingleThreadModel::CriticalSection

References class CComFakeCriticalSection.

CComSingleThreadModel::ThreadModelNoCS

References CComSingleThreadModel.

Public Methods

Name

Description

CComSingleThreadModel::Decrement

Decrements the value of the specified variable. This implementation is not thread-safe.

CComSingleThreadModel::Increment

Increments the value of the specified variable. This implementation is not thread-safe.

Remarks

CComSingleThreadModel provides methods for incrementing and decrementing the value of a variable. Unlike CComMultiThreadModel and CComMultiThreadModelNoCS, these methods are not thread-safe.

Typically, you use CComSingleThreadModel 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 model

Apartment threading model

Free threading model

CComObjectThreadModel

S

S

M

CComGlobalsThreadModel

S

M

M

S=CComSingleThreadModel; M=CComMultiThreadModel

CComSingleThreadModel itself defines three typedef names. ThreadModelNoCS references CComSingleThreadModel. AutoCriticalSection and CriticalSection reference class CComFakeCriticalSection, which provides empty methods associated with obtaining and releasing ownership of a critical section.

Requirements

Header: atlbase.h

See Also

Other Resources

ATL Class Overview