Inproc Object Custom Interface in Apartment Model ClientLast reviewed: July 25, 1996Article ID: Q137629 |
The information in this article applies to:
SUMMARYSingle threaded inproc objects (not marked with a ThreadingModel value), must provide marshaling code for any custom interfaces that they may implement.
MORE INFORMATIONAn OLE inproc object that is not marked with the ThreadingModel value in the system registry is considered single threaded. When an apartment model threaded client creates instances of this inproc object in its different threads, OLE cannot load the objects into those threads. This is because the object is single threaded and is not designed for multithreaded access by a client. Instead, OLE will instantiate the object in the main apartment (thread) of the client. (The main apartment is the thread that first called Co/OleIntialize.) The object will be marshaled to the other threads of the client that require use of it. This marshaling requires the inproc object to provide marshaling code for any custom interfaces it may implement. (The MIDL compiler can be used to generate marshaling code.) If this inproc object doesn't provide marshaling code for its custom interfaces, it can be used only by single threaded clients or by clients that use the object only from the main apartment. An object that is marked ThreadingModel=Apartment or ThreadingModel=Both is apartment model-aware. When an apartment model threaded client creates instances of this inproc object in its different threads, each instance will be instantiated in the respective apartments. Consequently the object need not provide marshaling code for any custom interfaces that it may implement.
|
Additional reference words: 4.00 CreateThread 32 bit
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |