I create new threads with AfxBeginThread
. I have tried exiting the thread with AfxExitThread and just returning a value. Both of those are supposed to be valid ways of exiting the thread.
However when making calls to GetExitCodeThread
I get STILL_ACTIVE
even after several hours. Also when using (WaitForSingleObject(ahtRespondThreads[i], 0) == WAIT_OBJECT_0)
shows that the thread object is still valid.
How are you supposed to tell if a thread has truly exited or not? Yes I know I could set some variables before the function exits but I would think I should be able to query the thread handle to know that it has exited or isn't a valid thread anymore.