共用方式為


2.2.2.3 Threading Model Property Formats

If an ORB provides a feature for hosting component instances on different types of threads, restrictions on the types of threads on which the component instances for a particular component will be hosted is represented in the catalog as a property of the component and of its component configurations.

An ORB that provides this feature divides all threads in a given process that will be used to host component instances into one of two categories:

  • Single threaded apartment (STA) threads are primarily used to host component instances when the component expects that all calls to any given component instance will be executed on a single thread. Optionally, the ORB designates one STA thread in each process as the Main STA thread.

  • Multi-threaded apartment (MTA) threads are used to host component instances when the component does not have such an expectation.

An ORB that provides this feature furthermore assigns to each component instance one of the following hosting models at the time that the component is instantiated:

  • In the STA-hosted model, all calls to the component instance are executed on the same thread. The component instance is said to be hosted on that thread.

  • In the MTA-hosted model, all calls to the component instance are executed on one of the MTA threads in the process. The specific thread used for any given call is selected according to ORB-specific criteria.<12>

  • In the neutral-hosted model, calls to the component instance are executed on any STA or MTA thread, selected according to ORB-specific criteria.<13>

Properties that use the formats specified in the following sections are an indication of how the ORB will select the hosting model for component instances. These property values are typically selected by the component itself, and COMA does not provide a mechanism for modifying the values. If an ORB does not provide such a feature, this SHOULD be indicated by using the values eTM_NEUTRAL and "Neutral" for all components. If an ORB does not designate one STA thread in each process as the Main STA thread, the values eTM_MAIN and null SHOULD NOT be used.