Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created one thread using createthread() which returns me handle and keep running main thread. I would like to know that thread completion event so that i can update my another function which update my User interface.

What I have tried:

I tried using Createevent() and setevent() , but this approach asking me to call wait(). I dont want to wait.
Posted
Updated 7-Nov-16 21:00pm
Comments
[no name] 8-Nov-16 2:40am    
The question is not clear and you should add more detail. However "I dont want to wait" makes no sense. How else will you synchronise threads?
http://stackoverflow.com/questions/811641/windows-threading-wait-method
Member 12483338 8-Nov-16 10:13am    
WaitForSingleObject() it keeps waiting main thread , which i don't want.

1 solution

If you only want to know if a Windows thread has terminated or not, use the GetExitCodeThread function (Windows)[^].

If you want to inform other threads that this one has terminated you can raise an event that is checked by other threads.

But this is not useful with the main (GUI) thread. To inform the main thread, you can use PostMessage with a user-defined message. The message can be send to any window by it's handle (e.g. the main window of an application).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900