crucial: Is this a ok way to terminate a thread?.


Code:
CWinThread *pThread=NULL;

UINT MyThread(LPVOID MyParam)
{
  while(1)
  {
     If(IsTrue)
     {
      //Do Something
     }
  }
  AfxEndThread(0);
 	
}

pThread=AfxBeginThread(MyThread, NULL);


close thread (Destroy Window):

if(pThread->m_hThread != (void*)0xdddddddd)
{
    DeleteObject(pThread);	
}