␡
- Creating and Using Threads
- Preventing Threading Problems
- Thread Termination
- From Here...
Like this article? We recommend
Thread Termination
If your thread doesn't terminate, it's going to be left hanging to take up valuable processor time and memory space.
You can call GetExitCodeThread with the thread's handle and a LPDWORD that holds the value of the thread-termination status. If the thread hasn't terminated, you'll get the value of STILL_ACTIVE in the LPDWORD. You can then loop until you get the return value of the thread, the exit value of the thread's process, or the value you specified in the ExitThread or TerminateThread function.