Re: CoInitializeEx and MTA
"George" <George@discussions.microsoft.com> wrote in message
news:2C7066B7-65D7-44F8-A8A8-BE08ECEC0B6D@microsoft.com
Suppose there are a couple of threads in an MTA, since a process
could have only one MTA, I think,
1. Even if each threads calls CoInitializeEx or CoInitialize, only
the first call allocates COM related resources, all subsequent calls
does not allocate any resources?
Correct.
2. Only the last call to CoUninitialize frees the COM resources in
the MTA, and at that time, the MTA terminates?
There are per-thread resources, too. CoUninitialize in a thread frees
resources allocated for this thread when it leaves MTA apartment. It is
correct that the apartment is destroyed when the last thread leaves it.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925