Navigation: Object Model Reference > Threading |
|
The Builder component is marked as Free threaded, meaning that it and the build thread that it creates when building will operate in the multi-threaded apartment (MTA) of the calling process. An alternate Builder component marked Both threaded, which can exist in a single-thread apartment (STA) or the MTA, is also available by using a ProgID of VisBuildSvr9.BuilderSTA or VisBuildSvr.BuilderSTA. Calling the Both version from an STA thread can yield better performance, but any event handling in the calling code of a GUI application must marshal all events back to the GUI thread, and any custom actions called from the build must support running from an STA.
Prior to v6.3, the GUI app and Console app always created the Free threaded builder component, so all built-in and custom actions marked as Both threaded that were created during a build would get created in the MTA. For performance reasons, starting with v6.3, the GUI and Console app now both enter an STA and use the Both threaded component by default, so actions marked as Both threaded will now get created in an STA. This can be overridden via the /mta command-line flag to force the older MTA threading mode. This might be desired if a custom action component is marked as Both threaded but actually needs to be created in the MTA (for instance, if it calls a non-blocking Wait API). The Watches, Call Stack, and Macros panes are also updated immediately during a build with MTA mode, but in STA mode these panes are not updated during a build unless the build is paused or debugged (singled-stepped) or the related option is enabled.
See this article for more details on COM threading models.