如何检索线程的“名称”?
(请参阅应用程序暂停的xcode图片,其中,我所称的“名称”以黄色突出显示,“com.apple.coremedia.player.async”...我可以检索正在运行的线程,并且曾尝试以下,没有运气
mach_msg_type_number_t count, i;
thread_act_array_t list;
task_threads(mach_task_self(), &list, &count);
for (i = 0; i < count; i++) {
if (list[i] == mach_thread_self()) continue;
char theName[16];
memset(theName, 0x00, sizeof(theName));
pthread_getname_np(list[i], theName);
printf("The thread name is %s.\n", theName);
}
注意:我不要求当前线程的线程名。我很感兴趣,从集运行的线程获得线程名(见上面的例子) ..所以有关[NSThread currentThread]的解决方案将不起作用
我相信PLCrashReporter是能够做到这一点,尝试检查他们的专页。 – borrrden 2013-03-14 04:47:08
你究竟想通过这样做完成什么? – eyebrowsoffire 2013-03-14 05:59:51
打印出每个正在运行的线程的线程名称 – user353877 2013-03-14 06:05:00