NSLog - What's the last number?
2009-11-24 10:53:48.760 TestApp[35935:207]
Date...Time...proc...pid...
What is that last number?
Date...Time...proc...pid...
What is that last number?
It's either process or thread id, I forget which.
_sjc_ Wrote:It's either process or thread id, I forget which.
Probably thread id since kelvin already identified the pid.
As far as I can tell, it is none of the following:
pid
thread id
gid
ppid
uid
host id
pid
thread id
gid
ppid
uid
host id
---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Blacktiger Wrote:Probably thread id since kelvin already identified the pid.
Yeah, thanks. If my posts weren't being held for moderation I would have edited that just after I hit submit.
The value in question is the current mach thread id -- the value returned from pthread_mach_thread_np() -- displayed in hex. See the public CFLite source code, CFUtilities.c, around line 705, for the source of the CFShow() function, which produces output identical to NSLog().
That's all well and good in theory but neither pthread_self() nor pthread_mach_thread_np(pthread_self()) give the value that NSLog does:
So while a thread ID does seem most likely, it's not one of those.
Code:
Desktop keith$ cat test.m
#import <Foundation/Foundation.h>
#import <unistd.h>
int main() {
NSLog(@"%p", pthread_self());
NSLog(@"%u", pthread_mach_thread_np(pthread_self()));
return 0;
}
Desktop keith$ gcc -Wall -Wextra -Werror test.m -framework Foundation
Desktop keith$ ./a.out
2009-11-27 10:06:48.758 a.out[24390:903] 0x7fff70e5abe0
2009-11-27 10:06:48.760 a.out[24390:903] 2307So while a thread ID does seem most likely, it's not one of those.
2307 == 0x903
Like I said above, it's displayed in hexadecimal.
Like I said above, it's displayed in hexadecimal.
Actually, if 903 is a hexadecimal value, then it is equal to 2307 (decimal)...
Mystery solved. What kind of weirdo thought that printing the thread ID as hexadecimal without a leading 0x was a good idea?
OneSadCookie Wrote:Mystery solved. What kind of weirdo thought that printing the thread ID as hexadecimal without a leading 0x was a good idea?
I only guessed because mine keep coming up with a "d" on the end.
Thanks for the replies!
---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB

