DragonFly BSD
DragonFly kernel List (threaded) for 2005-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: libthread_xu pthread_exit() behaviour


From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Fri, 23 Sep 2005 11:52:32 +0200
Mail-followup-to: kernel@crater.dragonflybsd.org

On Thu, Sep 22, 2005 at 07:05:16PM +0200, Simon 'corecode' Schubert wrote:
> 1.
> If the main() thread pthread_exit()s, the "process" visible to the 
> parent will exit.  This is because the kernel doesn't have the notion 
> of "threads" and "processes":  The pid of the "process" goes away and 
> thus all other threads become background processes (threads).

This is not unexpected. The PID has to be kept, just like the PID of a
Process Group must not be reused.

> 2.
> If the main() thread exit()s, it won't tear down all other threads.  
> This is an easy fix:  just use RFTHREAD in the rfork_thread() and this 
> works as expected.  On the other hand if the main thread 
> pthread_exit()s (see above) it will kill all other threads as well.

The former sounds good, the latter is a bug. I don't think we need a new
system call, sending a SIGKILL to itself should be enough to implement
exit. :-)

Joerg



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]