NSLog中的线程id,自己实现log的时候用得到
__uint64_t threadId=0;
if (pthread_threadid_np(0, &threadId)) {
threadId = pthread_mach_thread_np(pthread_self());
}
NSLog(@"%ld:%llu",(long)getpid(),threadId);
NSLog中的线程id,自己实现log的时候用得到
__uint64_t threadId=0;
if (pthread_threadid_np(0, &threadId)) {
threadId = pthread_mach_thread_np(pthread_self());
}
NSLog(@"%ld:%llu",(long)getpid(),threadId);