-
May 16th, 2010, 11:40 PM
#1
Kill a thread started by AfxBeginThread
Code:
CWinThread* myThread;
myThread = AfxBeginThread(ThreadFunction, this, THREAD_PRIORITY_NORMAL, 0, 0);
If I want to kill this thread, how to do that?
Thanks
Rate the posts which you find useful
-
May 16th, 2010, 11:46 PM
#2
Re: Kill a thread started by AfxBeginThread
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.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|