How to safely close a THREAD which has a infinite loop in it
问题 I am creating a thread using _beginthreadex function. The function address I am passing in it has an infinite while loop ( while(1) ) . I have the threadid and threadhandle . I can use TerminateThread(threadhandle,1); But it is dangerous. The safe way is to kill thread using _endthreadex but it can only be used from inside the thread, and I wanted to kill the thread from outside. So please suggest if there is a safe way to close,end or kill the thread safely from outside using threadid or