Sign in to follow this  

Question on Threads in VC++

This topic is 3791 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 modifying someone's code. I see they use CreateThread to spawn processing threads. They use an event to trigger an exit for the threads. I noticed they use the same m_hProcThread everytime they do a CreateThread. However, they never call CloseHandle on the thread handle. Is this correct? Or is it just a style thing? I don't want to change anything if I don't have to. I don't like to disturb people's code. Thanks.

Share this post


Link to post
Share on other sites
This isn't invalid, when a process terminates, all open handles are closed and all running threads are terminated1. It's just not tidy.

Skizz

1. It is possible to have a deadlock on exit.

Share this post


Link to post
Share on other sites

This topic is 3791 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this