|
-
June 2nd, 1999, 04:05 PM
#1
how do I know when a thread is completed?
Hi,
I'm using AfxBeginThread() to initiate a worker thread in my program. I want to initiate some action when this thread terminates. How can I detect whether the thread has been completed?
Thanks,
-Andrew
-
June 2nd, 1999, 07:15 PM
#2
Re: how do I know when a thread is completed?
Hi,
A couple of simple ways:
1) Use a CEvent, and signal it in the thread just before it finishes...
2) Send a message to the main thread from worker thread...
There is probably a "right" way to do this, but I use both of those...
HTH,
Harvey Hawes
Software Engineer
BioScience Analysis Software Ltd.
Masters Candidate
Cardiovascular/Respiratory Sciences
Faculty of Medicine
University of Calgary
Calgary, Alberta, Canada
-
June 2nd, 1999, 11:25 PM
#3
Re: how do I know when a thread is completed?
another way is to use WaitForSingleObject() which can take a thread handle
-
December 9th, 1999, 10:34 AM
#4
Re: how do I know when a thread is completed?
You have API called GetExitCodeThread(...).
Look it up ...
-
December 9th, 1999, 01:40 PM
#5
Re: how do I know when a thread is completed?
Search the knowledge base. The reason I am confident that that is a good idea is because I know that the two articles called "HOWTO: Detect All Program Terminations" and "Starting and Terminating Windows-Based Applications" are worth looking at.
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
|