Re: A question about _thread_ of Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/9/06, cheng long <kevinclcn@xxxxxxxxx> wrote:
> Why do you think so?
> pid is allocated by pid types. ie. pid is allocated differently for
> process (i mean those created with CLONE_THREAD) and threads. so they
> are so different.

#include <stdio.h>
#include <pthread.h>
int main()
{
    printf("main pid: %u\n", getpid());
    printf("main thread id: %u\n", pthread_self());
    return 0;
}

As we know, the tid is the first thread's pid, but the above progrom
prints two different number, how's that?


In this case tgid and pid must be same. it seems that pthread_self()
cannot be used without pthread_create. Don't know for sure.

regards
Manish Regmi

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux