CWorkerThread and IWorkerThreadClient not working in my ATL COM server
I am using CWorkerThread and IWorkerThreadClient in my ATL code but they
do not seem to be working in conjunction with
MsgWaitForMultipleObjectsEx. My code looks like:
// In the main thread:
workerThread = new CWorkerThread<>;
workerThreadImpl = new ProcessThread;
ProcessingData * data = new ProcessingData;
// Code to initialize processing data ...
workerThread -> Initialize();
if (res == WAIT_OBJECT_0)
// Thread has ended (1)
// Further processing...
In the worker thread:
HRESULT ProcessThread::Execute(DWORD_PTR dwParam,HANDLE hObject)
ProcessingData * data = reinterpret_cast<ProcessingData *>(dwParam);
// Lots of processing here ...
In the code above, the 'break' in the main 'while (true)' loop of my
main thread, shown at (1), is occuring before the Execute of my worker
thread is finished.
Am I missing something or is the worker thread not working like it
should in ATL ?