Hadi Rezaie
March 12th, 2006, 06:11 PM
Hi, :(
I don't know what's problem with my Worker Thread ...
But it just runs once !
I simply create my thread with CreateThread and pass an integer member variable as a parameter and in ThreadFunc body i add +1 to the member variable ...
I made a break point to check how many times the thread runs ... and it runs just once ! :(
Here it's my code:
void CTestingDlg::OnBnClickedOk()
{
m_nNum = 0;
m_hT = CreateThread( NULL, 0, TFunc, &m_nNum, 0, &m_threadID2 );
}
DWORD WINAPI CTestingDlg::TFunc( LPVOID lpParameter )
{
int *n = (int *) lpParameter; // I add break point here ...
*n = *n + 1;
return 0;
}
Help plz ...
I don't know what's problem with my Worker Thread ...
But it just runs once !
I simply create my thread with CreateThread and pass an integer member variable as a parameter and in ThreadFunc body i add +1 to the member variable ...
I made a break point to check how many times the thread runs ... and it runs just once ! :(
Here it's my code:
void CTestingDlg::OnBnClickedOk()
{
m_nNum = 0;
m_hT = CreateThread( NULL, 0, TFunc, &m_nNum, 0, &m_threadID2 );
}
DWORD WINAPI CTestingDlg::TFunc( LPVOID lpParameter )
{
int *n = (int *) lpParameter; // I add break point here ...
*n = *n + 1;
return 0;
}
Help plz ...