CLONE_THREAD

Carlos O'Donell carlos@systemhalted.org
Thu May 28 08:30:00 GMT 2009


On Wed, May 27, 2009 at 2:47 PM, Borislav Trifonov
<b.trifonov@crissyfieldmedia.com> wrote:
> Please redirect me if this is the wrong place to ask.  I ask here since
> people that wrote pthreads should certainly be able to answer this.

This mailing list is always the right place to ask any questions even
remotely related to glibc, it is equivalent to the gcc-help mailing
list.

> I read in the documentation of clone() that "When a CLONE_THREAD thread
> terminates, the thread that created it using clone() is not sent a SIGCHLD
> (or other termination) signal; nor can the status of such a thread be
> obtained using wait(2)."
> When I create CLONE_THREAD threads, I noticed that the first thread to exit
> causes the whole thread group to exit.  I'm wondering how I can exit
> individual threads while allowing others to continue.

Do you have a testcase for this? Which architecture are you targetting?

My expectation would have been that any thread that exits (either
directly or indirectly via a return from their entry function) is
detached and does not effect the rest of the threads in the process
group. However, the clone function (sys_clone syscall) accepts a wide
variety of clone flags, but in practice only a certain set of flags
setup a useful userspace process and threads. Which flags are you
passing to clone? Are you working on your own threading
implementation?

Cheers,
Carlos.



More information about the Libc-help mailing list