Code:CWinThread* myThread;
myThread = AfxBeginThread(ThreadFunction, this, THREAD_PRIORITY_NORMAL, 0, 0);
If I want to kill this thread, how to do that?
Thanks
Printable View
Code:CWinThread* myThread;
myThread = AfxBeginThread(ThreadFunction, this, THREAD_PRIORITY_NORMAL, 0, 0);
If I want to kill this thread, how to do that?
Thanks
To kill the thread get the thread handle m_hThread from myThread and call TerminateThread on the handle. Be warned though that terminating threads in this fashion is not recommended, the proper way is to signal your thread somehow to close on its own and wait for its closure in the main thread.