Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!+ From: Richard.Draves@CS.CMU.EDU Newsgroups: comp.os.mach Subject: Re: notification of thread death Message-ID: <8ZqaNoK00hYPEpsEdz@cs.cmu.edu> Date: 15 Feb 90 08:21:08 GMT References: <371@kgw2.bwi.WEC.COM> Sender: rpd@M.GP.CS.CMU.EDU Distribution: usa Organization: Carnegie Mellon, Pittsburgh, PA Lines: 22 In-Reply-To: <371@kgw2.bwi.WEC.COM> You are seeing two different problems. First, when a cthread exits, the underlying Mach thread is not terminated. It is left lying around, and will be reused for a new cthread. Because the underlying Mach thread isn't killed, the thread's kernel port isn't deallocated, and you don't see notification messages. Second, when a Mach thread is terminated, there is a special hack to keep the task it is in from getting a notification about the death of the thread's kernel port. Other tasks that have send rights for the port do get notification messages, as expected. This speeds up task termination, because it saves generating a bunch of notification messages (that will never get received) for all the threads. But it is a hack, and I can't defend it very enthusiastically. In any case, I don't think it is a good idea to kill a thread that the cthreads library thinks it is using. Perhaps you could just have your cthread send its own notification messages before it exits? Rich