Threads state after the program finishes execution

What happens to internal threads after the main thread finishes execution?

E.G:

Program 1 creates 5 threads to run in background. Program 1 crashes. Are those threads alive?

They will get killed because threads are bound in the process context?

Answers


All those resources are linked up to the process data structure. When a process is terminated Windows ensures that all the resources are cleaned-up.

Didn't manage to find references to docs [feel free to add some, I am sure I read this in M.Russinovich "Windows Internals" book], but here are couple of similar answers regarding memory dealocations. Thread clean up is part of the clean up routine that windows call when a process is terminated.

http://stackoverflow.com/a/2975844/706456

http://stackoverflow.com/a/654766/706456


Need Your Help

Stacking Rows of Images Using HTML5/CSS3?

html css image

I am trying to line images up row by row but for some reason the outcome is not what I want it to be. The only time the images break to a new line is when I fill the page. I tried overflow:hidden, ...

javascript string.replace against negative list

javascript regex

I know it's preferable to use a whitelist when dealing with regexp, but due to client requirement I can't do that. They don't want us to prevent the user from entering special characters - we need to

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.