I have a UI thread(CMyTHread) derived from CWinThread.


CMyThread* m_pThread; //member of CTestDialog;

CTestDialog::OnNewJob()
{
...
if( NULL != m_pThread )
{
m_pThread = new CMyThread( ...some params... );
m_pThread->CreateThread();
}
else
{
//it is already doing a job. it is not finished.
}
...
}


//thread has finished its job
//and mimic us about that by posting a win_msg
// then went out 'IniInstance' method
//so we are here
CTestDialog::OnThreadFinished()
{
delete m_pThread;
m_pThread = NULL;
}

My question is that:
Does 'delete m_pThread;' exit the thread and clear the whole memory successfully?

I ask this question because I noticed that
CMyThread::ExitInstance() method never called after delete line.
(CMyThread destructor is virtual)

*Please note that; I never called AfxEndThread() and PostQuitMessage() in the boundary of CMyThread class!