--- In [email protected], "entropyreduction" <alancampbelllists+ya...@...> wrote: > > while (bKeepGoing) > { > WaitForSingleObject(m_hEvtActionReq, INFINITE); > > _ASSERT(m_pCOMactionAbstract); > bKeepGoing = m_pCOMactionAbstract->doIt(); > //only COMactionReleaseAll::go() returns false > > ResetEvent(m_hEvtActionReq); > > if (bKeepGoing) // > SetEvent(m_hEvtActionDone); > } >
Thanks for it, I'll try to understand them. At a glance, however, I found a possible problem with it. As you may know already, CoInitialize/OleInitialize for STA creates a hidden Message-only window, OleMainThreadWndClass. But the code uses WaitForSingleObject, which will also block the messages to this window. Here is a quote in the MSDN documentation. http://msdn.microsoft.com/en-us/library/ms687032.aspx A thread that uses a wait function with no time-out interval may cause the system to become deadlocked. Two examples of code that indirectly creates windows are DDE and the CoInitialize function. So, I suggest to replace it with CoWaitForMultipleHandles. http://msdn.microsoft.com/en-us/library/ms680732.aspx And, the code doesn't create a message loop. I don't know if a message loop is really necessary here, may better to have it to know if there is no pending ones, as better call CoUninitialize/OleUninitialize after processing all the messages.
