RE: Slow pthread_create() under high load

From: David Schwartz (davids@webmaster.com)
Date: Tue Mar 28 2000 - 15:06:12 EST


> Can someone tell me why:
>
> pthread_creat( ....)
> if this is the first created thread
> rootpid = getpid();
> redefine getpid === return rootpid
>
> Doesn't work?

        Define 'work'. 'getpid' is hardly the only function that uses pids. What
about 'getppid'? As but one example, consider the following code:

pid_t pid=getpid(); /* This gets the pid of the original thread, not this
one */
fork();
if(getppid()==pid)
{
 /* I must be the child */
 /* But wait, am I really? */
}

        DS

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:22 EST