Thursday, July 4, 2013

Threading model (STA , MTA)

Recently, I am working on edge project, that need call the old dll to get file meta data.  this dll call com object, using STA model.
from call
CoInitialize(NULL);

Before I try change the caller's thread mode. but I do not know why we need STA model.

So, I try use
::CoInitializeEx(NULL, COINIT_MULTITHREADED)

using MTA instead of STA , see what happened.

Understanding The COM Single-Threaded Apartment Part 1  is helpful.

No comments:

Post a Comment