views:

33

answers:

1

I have a thread which creates COM objects that use the STA model.

This thread's Run function puts it in an infinite WaitForMultipleObjects.

Is it possible that the infinite WaitForMultipleObjects could prevent other threads from marshaling calls to the COM objects owned by this thread?

Basically, I'm asking if WaitForMultipleObjects would prevent the hidden COM message queue from being pumped.

+3  A: 

Yes, problems are possible - see this KB article. Basically if your thread is an STA thread it should not call functions that can block for long periods of time since while the thread is blocked it doesn't pump and dispatch messages and this can prevent proper marshalling functioning.

sharptooth
+1 for relevent kb article.
Chris Becke
The article and the sample code are NT4 and prior. Now you can use [CoWaitForMultipleHandles][1] [1]: http://msdn.microsoft.com/en-us/library/ms680732(VS.85).aspx
wqw