Re: STA component call MTA component
"George" <George@discussions.microsoft.com> wrote in message
news:A269A33A-6E72-4ECD-BA85-22C102D180CF@microsoft.com
If STA calls MTA, in my understanding, COM Runtime will create a new
thread which is responsible for invoking related method in MTA, and
when the method call returns, the specific thread is also responsible
for putting the return result into the message queue of the STA,
thread? My understanding correct?
Basically, yes. The runtime doesn't necessarily create a new thread for
each call, it can reuse threads it has created earlier and kept alive
after the previous call returns. But that doesn't really change the
scenario.
It is more precise that I should say, COM Runtime will maintain a
thread pool, which is dedicated for invoking related method in MTA,
and also dedicated for returning result to STA message queue, other
than say a specific thread will do such job?
Well, when an incoming call arrives, some thread from the pool is chosen
to handle it. This thread is responsible for executing the call from
beginning to end. Once the call returns and the output is passed to the
caller, the thread returns to the pool and can be reused for subsequent
calls.
--
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