Reputation: 56
Now, I've developed an ATL that compiled with _ATL_MULTI_THREADED. The COM dll was called in my C# winform appliaction. The COM interface look like this:(in c#)
public interface IMyInterface
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime),
void RunFunction();
}
In my C# application:
I created two threads that named TA,and TB.
In both the thread function body, I invoke the IMyInterface.RunFunction
method in parallel.
But, the codes in IMyInterface
run another thread.(not TA or TB)
If there is some setting to force the COM code runs in the client's thread???
Upvotes: 1
Views: 93
Reputation: 14736
Your winforms thread is STA which means that all calls, regardless of thread, to com objects created in the winform thread will use the winform thread. Create the com object in TA or TB
Upvotes: 1