site_archiver@lists.apple.com Delivered-To: Darwin-dev@lists.apple.com Thread-index: Acdqad+rHhHJvtZdEdui4gAWy4i6sA== Thread-topic: Thread number User-agent: Microsoft-Entourage/11.3.3.061214 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 David@alterConsulting.net 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/nelson%40thursby.com
This email sent to nelson@thursby.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Paul Nelson