Re: asynchronous and synchronous call between apartments
"George" <George@discussions.microsoft.com> wrote in message
news:5F2D90DE-FDE4-4836-9062-6D7FB5F138DF@microsoft.com
Once I thought all calls across COM apartments (not inside apartment)
are all synchronous call, now after study re-entrancy problem, I
think I am wrong, at least STA to MTA call is asynchronous.
Your terminology is confused. Reentrancy doesn't make the call
asynchronous. There exists such a thing as an asynchronous COM call (see
ICallFactory et al), which has nothing to do with reentrancy.
An asynchronous call returns immediately, without waiting for the server
to actually execute it. Then you typically need to make another call
some time later to pick up the result and any [out] parameters. A normal
call doesn't return until the server processes it (but yes, while
waiting for it to return, your code may be reentered).
You are correct in that reentrancy only affects calls made from an STA
apartment (whether to another STA or to MTA). MTA components don't
suffer reentrancy (the same thread running some code while waiting for a
call to return) but of course they experience concurrency (other threads
may call your component while it's waiting on one thread) - which of
course is the point of being multithreaded in the first place.
--
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