> 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. 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. Thanks, Roland _______________________________________________ perfmon mailing list [email protected] http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/
