Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C++
Reference
Libraries Reference
ATL
Typedefs
 CComGlobalsThreadModel

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
ATL Library Reference 
CComGlobalsThreadModel 

Calls the appropriate thread model methods, regardless of the threading model being used.

#if defined( _ATL_SINGLE_THREADED )
      typedef CComSingleThreadModel CComGlobalsThreadModel;
#elif defined( _ATL_APARTMENT_THREADED )
      typedef CComMultiThreadModel CComGlobalsThreadModel;
#elif defined( _ATL_FREE_THREADED )
      typedef CComMultiThreadModel CComGlobalsThreadModel;
#else
      #pragma message ("No global threading model defined")
#endif

Depending on the threading model used by your application, the typedef name CComGlobalsThreadModel references either CComSingleThreadModel or CComMultiThreadModel. These classes provide additional typedef names to reference a critical section class.

NoteNote

CComGlobalsThreadModel does not reference class CComMultiThreadModelNoCS.

Using CComGlobalsThreadModel frees you from specifying a particular threading model class. Regardless of the threading model being used, the appropriate methods will be called.

In addition to CComGlobalsThreadModel, ATL provides the typedef name CComObjectThreadModel. 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

Use CComObjectThreadModel within a single object class. Use CComGlobalsThreadModel in an object that is globally available to your program, or when you want to protect module resources across multiple threads.

Header: atlbase.h

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker