27 March 2009

Mutithreading and Outlook Programming

Outlook Object Model is run in a STA COM server. Single-Threaded Apartment COM server will execute all calls on its main (and single) thread. If a client running on another thread wants to call an object in a single threaded apartment, the two threads need to be forcibly synchronized. It is known as 'marshaling'.
That means that you don't gain any performance when using multithreading. All the calls are going to run on the same thread anyway and you incur the overhead hit. There's not really an advantage to multithreading Outlook Object Model.
You can learn more about COM programming here and here.

No comments:

Post a Comment