CComApartment

class CComApartment

CComApartment is used by CComAutoThreadModule to manage an apartment in a thread-pooled EXE module. CComApartment provides methods for incrementing and decrementing the lock count on a thread.

#include <atlbase.h>


CComApartment Class Members

Methods
ApartmentMarks the starting address of the thread.
GetLockCountReturns the current lock count on the thread.
LockIncrements the lock count on the thread.
UnlockDecrements the lock count on the thread.
Data Members
m_dwThreadIDContains the identifier of the thread.
m_hThreadContains the handle to the thread.
m_nLockCntContains the current lock count on the thread.

CComApartment Overview


Methods

CComApartment::Apartment

DWORD Apartment( );

Return Value

Always 0.

Remarks

The thread function marking the starting address of the thread. Automatically set during CComAutoThreadModule::Init.

CComApartment Overview | Class Members


CComApartment::GetLockCount

LONG GetLockCount( );

Return Value

The lock count on the thread.

Remarks

Returns the current lock count on the thread.

CComApartment Overview | Class Members

See Also CComApartment::Lock, CComApartment::Unlock, CComApartment::m_nLockCnt


CComApartment::Lock

LONG Lock( );

Return Value

A value that may be useful for diagnostics or testing.

Remarks

Performs an atomic increment on the thread's lock count. Called by CComAutoThreadModule::Lock.

The lock count on the thread is used for statistical purposes.

CComApartment Overview | Class Members

See Also CComApartment:Unlock, CComApartment::GetLockCount, CComApartment::m_nLockCnt


CComApartment::Unlock

LONG Unlock( );

Return Value

A value that may be useful for diagnostics or testing.

Remarks

Performs an atomic decrement on the thread's lock count. Called by CComAutoThreadModule::Unlock.

The lock count on the thread is used for statistical purposes.

CComApartment Overview | Class Members

See Also CComApartment:Lock, CComApartment::GetLockCount, CComApartment::m_nLockCnt


Data Members


CComApartment::m_dwThreadID

DWORD m_dwThreadID;

Remarks

Contains the identifier of the thread.

CComApartment Overview | Class Members


CComApartment::m_hThread

HANDLE m_hThread;

Remarks

Contains the handle to the thread.

CComApartment Overview | Class Members


CComApartment::m_nLockCnt

LONG m_nLockCnt;

Remarks

Contains the current lock count on the thread.

CComApartment Overview | Class Members

See Also CComApartment::Lock, CComApartment::Unlock