In Windows, it is possible to set the threadname via this code. The threadname is then shown in debuggers.
In MacOSX, I have seen several hints which indicates that there are threadnames. I think the class NSThread also has a name-attribute. My goal is that I can set the threadname in my C++ application and see it in Xcode/gdb.
Other related questions:
I recommend the following:
[[NSThread currentThread] setName:@"My thread name"]; // For Cocoa
pthread_setname_np("My thread name"); // For GDB.
(You'll need to include pthread.h) Works a treat in XCode 3.2.3 (at least for iPhone development)
Which version of Xcode are you using? Thread names are only supported in Mac OS X 10.6 and Xcode 3.2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With