Article ID: 244495 - View products that this article applies to.
This article was previously published under Q244495
The Microsoft Active Template Library (ATL) allows you to define a pool of STA threads in an ATL out of process server with each object created running on its own thread. The steps in the "More Information" section of this article shows how to do this.
The following steps are needed to create objects out of a thread pool:
By default, ATL creates a pool of four threads per processor. You can change this in the _Module.Init() call in the tWinMain() function call by specifying the number of threads in the optional forth parameter. By default, CComAutoThreadModule uses CComSimpleThreadAllocator as the thread allocator. CComSimpleThreadAllocator uses a simple round robin scheme to creating objects in the thread pool.
For more information lookup DECLARE_CLASS_FACTORY_AUTO_THREAD() and CComAutoThreadModule and the Microsoft Developer's Network (MSDN).
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/202128/ )FIX: ATL EXE server based on CComAutoThreadModule may hang on registration
Article ID: 244495 - Last Review: May 26, 2005 - Revision: 3.0