Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

threading

Specifies the threading model for a COM object.

[ threading(
   model=enumeration
) ]

Parameter

model (optional)
One of the following threading models:
  • apartment (apartment threading)
  • neutral (.NET Framework components with no user interface)
  • single (simple threading)
  • free (free threading)
  • both (apartment and free threading)

The default value is apartment.

Attribute Context

Applies to class, struct
Repeatable No
Required attributes coclass
Invalid attributes None

For more information about the attribute contexts, see Attribute Contexts.

Remarks

The threading C++ attribute does not appear in the generated .idl file but will be used in the implementation of your COM object.

ATL Projects

If the coclass attribute is also present, the threading model specified by model is passed as the template parameter to the CComObjectRootEx class, inserted by the coclass attribute.

The threading attribute also guards access to an event_source.

Example

See the licensed example for a sample use of threading.

See Also

COM Attributes | Typedef, Enum, Union, and Struct Attributes | Class Attributes | Multithreading | Neutral Apartments | Attributes Samples

Show:
© 2014 Microsoft. All rights reserved.