libthread_xu pthread_exit() behaviour

Joerg Sonnenberger joerg at
Fri Sep 23 03:01:24 PDT 2005

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. :-)


More information about the Kernel mailing list