Re: Thread number
Re: Thread number
- Subject: Re: Thread number
- From: Paul Nelson <email@hidden>
- Date: Mon, 19 Mar 2007 16:02:16 -0500
- Thread-topic: Thread number
Here is what I do:
(gdb) info threads
3 process 12851 thread 0x3003 tss_resolver_thread (arg=0x0) at /xx.c:471
2 process 12851 thread 0x1607 0x90009bf7 in mach_msg_trap ()
* 1 process 12851 local thread 0x1003 resolver_thread_initialize () at
/xx.c:560
After a thread is created using
pthread_create( &resolver_thread, NULL, tss_resolver_thread, NULL );
(gdb) print resolver_thread
$3 = (pthread_t) 0x180be00
(gdb) x/16x resolver_thread
0x180be00: 0x54485244 0x00000000 0x00000000 0x00010101
0x180be10: 0x00001000 0x00000000 0x0000001f 0x0000000a
0x180be20: 0x00000000 0x00000000 0x00000000 0x00000000
0x180be30: 0x00000000 0x00003003 0x00023944 0x00000000
notice that the uint32 at pthread_t+34 is the same value that gdb prints for
the thread number.
Paul Nelson
Thursby Software Systems, Inc.
on 3/19/07 3:35 PM, David Alter at email@hidden wrote:
> My apologies if this is too basic of a question. I have not had much
> success in finding an answer searching the archives.
>
> I want to get the thread number for a pthread. When I say the thread
> number, I'm looking for the same thread number that gdb would use
> when selecting threads to debug. I want the thread number to be part
> of the information I log.
>
> I can get pthread_t easily but how do I then the thread number out of
> that. Or do I need to look somewhere else for this information.
>
> to get pThread_t ...
>
> pthread_t thread = pthread_self();
>
> thanks for the help
> -dave
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden