How do you kill a thread from the main application when the thread is in some sort of blocking call and is not receiving any messages from the system. Is there an easy answer I am missing.
Thanx for your insight.
shellreef
May 20th, 1999, 06:55 PM
What I usually do is set a global flag (of type BOOL). The thread's main loop checks if the flag is TRUE,
and if so the thread is exited. For example:
BOOL stopthread = FALSE;
UINT ThreadFunction(LPVOID lp)
{
while (1)
{
if (stopthread) return 0;
}
}
Then anywhere in your code you could set 'stopthread' to TRUE to stop the thread.