3 ms·
"If the main thread exits, the process dies." This is true on Unix/Linux. I believe this is not true on Windows. (I'm not a Windows dev, so feel free to enligh
by wtracy 15y ago
"If the main thread exits, the process dies."
This is true on Unix/Linux. I believe this is not true on Windows. (I'm not a Windows dev, so feel free to enlighten me if I am wrong.)
Everything else in the article seemed pretty OS-independent.
- yread 15y agoI'm not sure how is it done in Win32, but in .NET there is a IsBackground flag on a thread. Process dies when all its non-background threads exit. http://msdn.microsoft.com/en-us/library/h339syd0.aspx http://msdn.microsoft.com/en-us/library/h339syd0.aspx EDIT: It seems that in win32 the process does indeed die when the last thread exits. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms682659(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/ms68...
- dbattaglia 15y agoRaymond Chen has a pretty good blog post on this: http://blogs.msdn.com/b/oldnewthing/archive/2010/08/27/10054832.aspx http://blogs.msdn.com/b/oldnewthing/archive/2010/08/27/10054... Basically, Win32 wants all threads to die out before the process exits, but the C runtime will exit out the process for you when your "main" thread dies.