Subj : Re: Main thread going away but worker threads executing? To : comp.programming.threads From : Doug Harrison Date : Fri Jul 22 2005 09:41 am On Thu, 21 Jul 2005 14:29:54 -0700, Kev wrote: > I can prove that killing the main thread doesn't automatically kill > spawned threads in C#. (I have a function in which I create a few > ThreadStart objects and then start threads using them. I call that > function from Main() and exit immediately with a message. The other > threads continue executing long after the Main thread is gone. I have > been able to verify my observations with the Threads window in Visual > Studio's debugger.) That's not true for background threads, which include threadpool threads and by extension, asynchronous delegates: Foreground and Background Threads http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconthreadlevels.asp > However, how do I prove the opposite for unmanaged C/C++? I want to write > a very simple C or C++ program (on Windows) that shows a main thread > killing all its spawned threads on exiting. I looked at the sample MSDN > program with C and Win32 available at http://snipurl.com/gf08 but it > couldn't do what I wanted... See the example I presented in this message: http://groups-beta.google.com/group/microsoft.public.vc.mfc/msg/e2a814217aacd8a8?hl=en& -- Doug Harrison dsh@mvps.org .