Which blocking operations cause an STA thread to pump COM messages?

BlockingCollection will indeed pump while blocking. I’ve learnt that while answering the following question, which has some interesting details about STA pumping: StaTaskScheduler and STA thread message pumping However, it will pump a very limited undisclosed set of COM-specific messages, same as the other APIs you listed. It won’t pump general purpose Win32 messages (a … Read more

What is a message pump?

A message loop is a small piece of code that exists in any native Windows program. It roughly looks like this: MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } The GetMessage() Win32 API retrieves a message from Windows. Your program typically spends 99.9% of its time there, waiting for Windows to tell … Read more