Single Threaded Apartment

A SingleThreadedApartment (STA) is serialized by a Windows message pump. All calls to any components that live in the apartment are serialized.

As opposed to the MultiThreadedApartment, there can be more than one STA per process.

STA's are reentrant, however, meaning that a method on an object in the apartment can be called while an outbound call is still pending. This is mainly because the inbound call could be a nested call caused by the outbound call, and COM plays it safe to avoid deadlocks.


ComponentObjectModel achieves this because a SingleThreadedApartment has a window (hidden) associated with it and a windows message loop. The message loop achieves synchronization by serializing the messages into the window's message queue. -- sg


See also:


CategoryComponentObjectModel CategoryGlossary CategoryDefinition


EditText of this page (last edited August 14, 2010) or FindPage with title or text search