Re: Thread_Id

Benedikt Spranger
2005-07-14T13:08:27Z

> And you certainly shouldn't be using gettid () syscall in NPTL, as it
> is just an implementation detail that there is a 1:1 mapping between
> NPTL threads and kernel threads. It can change at any time.

Maybe I missed the point, but I thought the 1:1 mapping between NPTL
threads and kernel threads is one of the advantages of NPTL and the idea
of a userland scheduler is quite dead.

So please let gettid do what man gettid assures:
gettid returns the thread ID of the current process. This is equal to
the process ID (as returned by getpid(2)), unless the process is part
of a thread group (created by specifying the CLONE_THREAD flag to the
clone(2) system call). All processes in the same thread group have the
same PID, but each one has a unique TID.

Bene