Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

STA COM instances - serialized access

0 views
Skip to first unread message

Martin Plechsmid

unread,
Dec 7, 2009, 5:10:13 AM12/7/09
to
Hello.

I have an in-process COM server (DLL implemented in .NET) that supports
threading model "both".
I have two STA threads (initialized via CoInitialize(NULL)), each of them
creates *its own* instance of the COM, via CoCreateInstance, CLSCTX_ALL.

When one of the instances serves a request, is the second instance blocked?

I don't think the instances should block each other, if they are different
and each one is accessed from its creating thread only. At least, I
understand the STA documentation this way. But in reality I have exactly
this situation, and my application behaves as if access to the whole DLL
server was serialized. We've witten the DLL ourselves, so I'm sure the DLL
doesn't use locking at the static methods level.

Thank you,
Martin.


Igor Tandetnik

unread,
Dec 7, 2009, 7:40:57 AM12/7/09
to
Martin Plechsmid wrote:
> I have an in-process COM server (DLL implemented in .NET) that supports
> threading model "both".
> I have two STA threads (initialized via CoInitialize(NULL)), each of them
> creates *its own* instance of the COM, via CoCreateInstance, CLSCTX_ALL.
>
> When one of the instances serves a request, is the second instance blocked?

Not by COM. Your code could be doing its own locking, of course. However, I know next to nothing about .NET COM interop - perhaps .NET is doing some kind of locking, too. You may want to ask in microsoft.public.dotnet.framework.interop
--
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

0 new messages