Xcode’s “thread list” pane shows English-like names for several special threads: com.apple.main-thread, com.apple.libdispatch-manager, com.dispatchfractal.opencl, com.dispatchfractal.opengl, com.apple.root.low-priority,… But for user-created threads that field is just blank.
Is there any way to set that “thread name” field programmatically from my application? For example, if I’ve got a thread devoted to network I/O, I’d like it to show up as “com.example.network-io” in the debugger; if I spawn five worker threads I’d like to be able to name them “worker A”, “worker B”, etc. Does Xcode pull its thread-names from some API that I could hook into myself? Maybe something like CFAssignDebuggerNameToCurrentThread? 🙂

Probably not exactly what you want but NSThread has
setName:method that allows you to set thread’s name, you can attach meaningful name to the thread so you’ll get the following in debugger:Remember also that some apis (like grand central dispatch) operate with thread pools so you are not guaranteed on what thread your operation will be performed
Edit:
com.apple.main-thread,com.apple.libdispatch-manageretc are labels of corresponding dispatch queues. You can set label value when queue is created withdispatch_queue_createfunction and later get it from the queue usingdispatch_queue_get_labelfunction.It seems there’s no API to change label value of the existing dispatch queue and I would not advise to change labels of the system queues anyway.