Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
纯粹出于好奇:
我在 XCode 4 GM 中做一些 UNIX 开发,我注意到在控制台输出中进程 ID 以十进制显示,而线程 ID 以十六进制显示。
例子:
[Switching to process 37574 thread 0x0]
为什么要使用这些约定?
谢谢,
斯科特
可能是因为进程 ID 通常以十进制显示(Activity Monitor、top、ps 等),而线程 ID 通常以十六进制显示(gdb、各种其他调试工具)。我怀疑其原因最终是因为它们更容易区分。(只需记住“2378,0xF4”,您不需要记住哪个是 pid 或 tid。)