Udostępnij za pośrednictwem


CComSimpleThreadAllocator Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CComSimpleThreadAllocator Class.

This class manages thread selection for the class CComAutoThreadModule.

Syntax

class CComSimpleThreadAllocator

Members

Public Methods

Name Description
CComSimpleThreadAllocator::GetThread Selects a thread.

Remarks

CComSimpleThreadAllocator manages thread selection for CComAutoThreadModule. CComSimpleThreadAllocator::GetThread simply cycles through each thread and returns the next one in the sequence.

Requirements

Header: atlbase.h

CComSimpleThreadAllocator::GetThread

Selects a thread by specifying the next thread in the sequence.

int GetThread(CComApartment* /* pApt */, int nThreads);

Parameters

pApt
Not used in ATL's default implementation.

nThreads
The maximum number of threads in the EXE module.

Return Value

An integer between zero and ( nThreads – 1). Identifies one of the threads in the EXE module.

Remarks

You can override GetThread to provide a different method of selection or to make use of the pApt parameter.

GetThread is called by CComAutoThreadModule::CreateInstance.

See Also

CComApartment Class
Class Overview