This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: CLONE_THREAD
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: Borislav Trifonov <b dot trifonov at crissyfieldmedia dot com>
- Cc: libc-help at sourceware dot org
- Date: Thu, 28 May 2009 04:30:01 -0400
- Subject: Re: CLONE_THREAD
- References: <20090527134706.h4ymz007u6gkc8kg@webmail.opentransfer.com>
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.