lkml.org 
[lkml]   [2005]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Thread_Id
On Thu, Jul 14, 2005 at 02:25:43PM +0200, Arjan van de Ven wrote:
> pure luck. NPTL threading uses it to store a pointer to per thread info
> structure; other threading (linuxthreads) may have stored a pid there to
> identify the internal thread. nptl is 2.6 only so you might have
> switched implementation of threading when you switched kernels.

Actually, in linuxthreads what pthread_self () returned has the first slot
in its internal threads array (up to max number of supported threads)
that was unused at thread creation time in the low order bits and sequence
number of thread creation in its high order bits.
So unless you are using yet another threading library (I thought NGPT
is dead for years...), the claim that you get the same numbers from
gettid() syscall under NPTL as pthread_self () gives you under LinuxThreads
is simply not true. 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.

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

\
 
 \ /
  Last update: 2005-07-14 14:43    [W:0.044 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site