"clinisbut" <clinisbut@gmail.com> wrote in message
news:fd46315b-cfa9-4ac7-95e6-45a9690c1d6e@d21g2000prf.googlegroups.com...
Sorry, I look better for the problem and I found that actually it pass
ok through that WFSO( pReaderThread->m_hThread, INFINITE ). That was
another problem (not related) and all code is executed, but still with
that memory leak:
MySerial.cpp(21) : {120} client block at 0x00432410, subtype 0, 224
bytes long. a MySerial object at $00432410, 224 bytes long
That points to
IMPLEMENT_DYNCREATE(MySerial, CWinThread)
in my header.
If I recall correctly, you turned off m_bAutoDelete. And now the thread
is closing properly and WFSO returns OK, meaning the thread has exited.
When you turn off m_bAutoDelete it means you are responsible for the
deleting. Why are you surprised that with m_bAutoDelete off it does not
get deleted?
So after WFSO returns you should do CloseHandle on all open handles,
including pReaderThread->m_hThread, and then delete pReaderThread.
The object not being deleted is MySerial, not the reader thread. The reader
thread is a worker thread and has no CWinThread object to delete.
and he calls WFSO on both of them.