Objects Marked as Both

This threading model is highly recommended for components that will be called by Active Server Pages.

ActiveX objects marked as both can be used in either apartment-threaded or free-threaded modes. They can be entered by multiple threads, protect their data from thread collisions, and do not contain thread-specific data.

The Web server creates an object marked as both in a single thread, the one that serviced the request. The call to CoCreateInstance is not marshaled to another thread. However, if the object has session scope or is placed in the Session object, the Web server will not lock the session to that thread. Calls to the object from other requests in the same session are executed in the request thread.

Because objects marked as both guarantee to protect their data against multiple thread access, they can be used for objects that have application scope.

© Microsoft Corporation. All rights reserved.