A
ThreadNeutralApartment, or TNA, is a new
ThreadingModel introduced in
ComPlus. It is the "preferred" apartment in
ComPlus, because it yields the highest level of flexibility/performance.
The main difference between the
ThreadNeutralApartment and the other apartment models (
SingleThreadedApartment and
MultiThreadedApartment) is that no thread context switch is required upon making a call to a
ComComponent that lives there. Like the
MultiThreadedApartment, there is only one
ThreadNeutralApartment per process.
If a
ComComponent requires serialized access, it can still live in the TNA, but must be marked with an extra attribute that tells the
ComPlus runtime to allow only one thread at a time to access the object. In this case, you still benefit from no thread context switch.
ComComponent-s that use this type of configuration are referred to as
RentalThreadedComponent-s.
I also suspect that there are significant savings in marshalling overhead. --
PierrePhaneuf
See also:
ComponentObjectModel,
ComPlus,
SingleThreadedApartment,
MultiThreadedApartment,
RentalThreadedComponent
CategoryComponentObjectModel