Sign in to follow this  
fathom88

Question on Threads in VC++

Recommended Posts

fathom88    180
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
Skizz    794
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

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