Getting thread id of current method call

后端 未结 6 735
隐瞒了意图╮
隐瞒了意图╮ 2020-12-07 14:01

Is there a way to print out the current thread id on which the current method is executing on?

(objective-c please)

6条回答
  •  悲哀的现实
    2020-12-07 14:05

    #include 
    ...
    mach_port_t machTID = pthread_mach_thread_np(pthread_self());
    NSLog(@"current thread: %x", machTID);
    

提交回复
热议问题