|
From: Tom H. <th...@cy...> - 2004-02-11 07:24:22
|
In message <200...@re...>
mw...@re... wrote:
> On Tuesday 10 February 2004 21:59, Tom Hughes wrote:
>
> > That gettid won't do anything useful as it will return the same value
> > in every thread which is most unlikely to be what the client program is
> > expecting to happen.
>
> Since i had a look at man 2 gettid and man 2 getpid it should behave like
> getpid. So i took the implementation of getpid and cloned it for gettid to
> get rid of messages telling me that syscall 224 isn't implemented.
Not true, as getpid returns the PID of the first thread no matter which
thread it is called in while gettid returnd the PID of whichever thread
it is called in.
The gettid manual does explain this:
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.
The problem is that under valgrind all the threads one in one kernel
level thread so the value returned by gettid will not vary with your
implementation.
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|