[asterisk-dev] Asterisk vs system thread IDs

Mark Murawski markm-lists at intellasoft.net
Tue Feb 15 10:02:42 CST 2011


I can write up a patch for this to throw into trunk.

He's talking about pids/lwp versus thread ids

You want the LWP

asterisk.c
struct thread_list_t {
         AST_RWLIST_ENTRY(thread_list_t) list;
         char *name;
         pthread_t id;
         pid_t lwp;  <-- add
};

void ast_register_thread(char *name)
{
....
         new->id = pthread_self();
         new->lwp = syscall(SYS_gettid); <-- add


static char *handle_show_threads(struct ast_cli_entry *e, int cmd, 
struct ast_cli_args *a)
...
   AST_RWLIST_TRAVERSE(&thread_list, cur, list) {
     ast_cli(a->fd, "%p %ld %s\n", (void *)cur->id, (long)cur->lwp, 
cur->name); <-- change






On 02/14/2011 10:15 PM, 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?
>




More information about the asterisk-dev mailing list