Roland,

On Sat, Apr 07, 2007 at 01:00:52AM -0700, Roland McGrath wrote:
> > Looking at the kernel header, I noticed a __WNOTHREAD. I am not clear on
> > what this one really does. Could you explain?
> 
> Normally wait* calls look for any ready child (or ptrace attachee)
> of any thread in the process (thread group).  The POSIX concept of
> parents and children is only about processes, but in Linux the
> actual links are between individual threads and the POSIX behavior
> comes about in ways like wait looking at each sibling's children
> list.  Unlike things with POSIX processes, ptrace is actually always
> thread to thread.  Only the one thread that did PTRACE_ATTACH (or
> fork'd the child) can use ptrace on it, but normally wait* calls
> made by any other thread in the process can instead be the one to
> report its stops.
> 
I was just wondering about this. So from what you are saying it is 
possible to have multiple threads ptracing multiple threads in 
one process. Thus  n to n and 1 to n are supported but n to 1 isn't.


> The __WNOTHREAD option tells wait* to check only the calling
> thread's own children (and ptrace attachees).  When the ptracer
> isn't part of a multithreaded process, it has no effect.  When it
> is, you might as well use __WNOTHREAD if you are only interested in
> ptrace-attached threads and are calling wait* in the ptracer thread.
> It saves some loops around the thread list.  If there are other
> threads in the process that might call wait*, then you need to make
> sure they do use __WNOTHREAD if you don't want them to swallow the
> reports from your ptrace targets.
> 
Ok that makes sense. I need to check pfmon. I tstill think the name
is mislieading. From your description, it would have been better to 
call the flag __WMYTHREADS or something like this.

Thanks.

-- 
-Stephane
_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

Reply via email to