Hello everyone,

I have tried to get a derived CWinThread to loop and so far have not had any luck. Here is what I have:

BOOL InterfaceDlg::OnInitDialog()
{
StartProcessThread();
}

void CEllistar_InterfaceDlg::StartProcessThread()
{
pThread = (CReaderThread*) AfxBeginThread(RUNTIME_CLASS(CReaderThread), THREAD_PRIORITY_NORMAL,NULL,0,NULL);
if (pThread)
{
m_ThreadList.Add(pThread);
pThread->SetLogWindow(this);
}
}

Inside of CReaderThread I have:

BOOL CReaderThread::InitInstance()
{
while(flag != 0)
{
// my processing code here
}

int CReaderThread::ExitInstance()
{
// TODO: perform any per-thread cleanup here
return CWinThread::ExitInstance();
}


return FALSE;
}

Can anyone spot why this code does not loop? When I trace it it enters InitInstance, but does not run any of the code inside it!