Threading model is a kind of mathematical model, and used for multithreaded programming algorithm, but also is only algorithm, not the implementation. This article explain various types of thread model put forward by the COM, COM again that run time library is how to achieve them, just like how Windows make thread this mathematical model, and finally pointed out the across suites calls and various types of suites to help understand the writing requirement.
COM threading model provided a total of three kinds: Single - Threaded Apartment (STA single-threaded Apartment), Multithreaded Apartment (MTA Multithreaded suites) and Neutral Apartment/Thread Neutral Apartment/Neutral Threaded Apartment (NA/TNA NTA Neutral Thread Apartment, provided by COM +). Although they name contain the word suite, this is just the COM runtime library (note, not COM specification, hereinafter referred to as COM) using suite technology to realize the front three thread model, suites and thread model is not the same concept should be paid attention to. COM provides a suite of three, respectively.
However the existence of the threading model is caused by different threads rules, the so-called rules of thread is only two: code is thread-safe or unsafe, the code to access common data access conflict will or will not. Due to the thread model is a model, conceptual, so can go against it, but can't get COM automatic synchronous calls and compatibility of benefits.
STA an object by only one thread access (through object interface pointer to call its methods), other threads can not access the object, so for all calls this object is out of synchronization, the state of an object (that is, the value of the object's member variables) must be correct, there will be no threads access conflict and lead to object state error. As mentioned, this model is very much like Windows provide window message mechanism, so the thread model is very suitable for have interface components, such as ActiveX controls, OLE server document, should use the STA suites.