[asterisk-dev] Asterisk vs system thread IDs

Tilghman Lesher tilghman at meg.abyt.es
Tue Feb 15 02:00:33 CST 2011

On Tuesday 15 February 2011 01:03:28 Kirill Katsnelson wrote:
> On 110214 1915, Tilghman Lesher wrote:
> > On Monday 14 February 2011 18:50:54 Kirill Katsnelson wrote:
> >> `core show locks' and `core show threads' print 64-bit threads IDs,
> >> the system uses 16-bit ones. Is there a way to map one to another?
> >> 
> >> Linux 2.6.28 x86_64 here.
> > 
> > /usr/include/bits/pthreadtypes.h says that the pthread_t type is an
> > unsigned long int.  What weird x86_64 system are you running where a
> > long integer is only 16-bits wide?
> Ubuntu Server 9 jaunty, kernel 2.6.28.
> Maybe I was wrong with the assumption they are 16 bit; they just never
> exceeded 16 bits in range in my experience. Let's say they are just two
> ways to identify threads. I am talking about numbers shown
> a) by top -H -p `cat /var/run/asterisk.pid`
> b) by gdb `info threads', second column.

Well, there's your problem.  The numbers in the FOURTH column are identical
to the numbers in the output of 'core show threads'.  You're just looking
in the wrong place.  The numbers in the second column are merely indices,
for the purpose of simplifying debugging.  They are not intended to be used
outside of gdb:

  6 Thread 0x7f07860e4700 (LWP 10758)  0x00007f07b4439f93 in *__GI___poll 
(fds=<value optimized out>, nfds=<value optimized out>, timeout=1000) at 
  5 Thread 0x7f0786068700 (LWP 10759)  0x00007f07b440a39d in nanosleep () 
at ../sysdeps/unix/syscall-template.S:82
  4 Thread 0x7f0785fec700 (LWP 10760)  0x00007f07b440a39d in nanosleep () 
at ../sysdeps/unix/syscall-template.S:82
  3 Thread 0x7f0785f70700 (LWP 10761)  pthread_cond_wait@@GLIBC_2.3.2 () at 
  2 Thread 0x7f0785ef4700 (LWP 10762)  0x00007f07b4439f93 in *__GI___poll 
(fds=<value optimized out>, nfds=<value optimized out>, timeout=-1) at 
* 1 Thread 0x7f07b4eb1700 (LWP 31726)  0x00007f07b44384bd in read () at 


More information about the asterisk-dev mailing list