Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!uccba!spca6!kgw2!erich From: erich@kgw2.bwi.WEC.COM (Eric Hammond) Newsgroups: comp.os.mach Subject: cthread termination (was: notification of thread death) Message-ID: <374@kgw2.bwi.WEC.COM> Date: 16 Feb 90 17:23:52 GMT Distribution: usa Organization: Xetron Corp, Cincinnati Ohio Lines: 31 In article <8ZqaNoK00hYPEpsEdz@cs.cmu.edu> Richard.Draves@CS.CMU.EDU writes: > 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? At the moment I am doing the equivalent of sending notification of cthread termination just before each cthread exits. So far this is working fine; however, I have a couple more questions: 1) Is there any way for a cthread to terminate unexpectedly (i.e., without doing an explicit cthread_exit() or returning from the cthread's top level function)? Tasks may be terminated by memory exceptions, signals, etc.; is there anything like this that will terminate a single cthread? (I don't want any cthreads in this task to die without the main cthread of the task knowing it.) 2) I understand the problem with thread_terminate()ing a thread out from under the cthread library implementation. Is there any way to do a cthread_terminate()? How can one cthread terminate the execution of another cthread in a task? Is it necessary to set up a "please kill yourself" message or to use similar inter-cthread cooperation? Thanks also to Bill Bolosky for responding to the original question. -- Eric Hammond erich@kgw2.bwi.wec.com