如何檢索線程的「名稱」?
(請參閱應用程序暫停的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