I have created a thread by the “CreateThread” function.
in this thread, I have a ‘while(true)’ loop (that reads input).
for now, when I want to close the thread, I use the ‘CloseHandle’ function.
Is this the right thing to do? Or I should exit the ‘while(true)’ loop and then use the ‘CloseHandle’ function?
Thanks
CloseHandle() does not destroy, terminate or supspend the thread, it only destroys the handle itself (so then you don’t have a handle to kill the thread or wait on it). The thread continues to work normally (I have utilised this in numerous cases), and the only way to stop it is either exit the thread function (ThreadProc()), or kill it.