Jump to content
  • Advertisement
Sign in to follow this  
fathom88

Win App Not Waiting For Thread To End??

This topic is 4212 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm writing a Win MFC app in VC++. I have several threads which run in the background. The threads close out when I send a cmd to stop them called StopAllThreads(). I wait for the threads to exit. However, I have a problem when I exit out and make the same call. Windows closes the my app's window just fine. However, I can still see the app is running when I bring up task manager. I don't think Windows is waiting for my threads to end. One of my threads takes some time to end because it's doing a periodic socket "Connect" when the server down to try and re-estab a connection. I could be calling the StopAllThreads() func in the wrong place. Should I have my Doc class respond to the ShutDown message by making the call to StopAllThreads()? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure I understand the problem. If your task is still running, then at least one thread is still alive, regardless of whether or not any window is visible. Closing a window doesn't necessarily have any relationship to running threads.

What exactly does StopAllThreads do? How does it signal each thread to stop? How does each thread stop? Have you tried having each thread open a log file and record when it was started and when it was stopped, to isolate which thread is remaining alive and what it is doing?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!