10

For profiling multithreaded applications, it would be very useful to me to set a name for each thread.

Initial googling turns up pthread_setname_np() (see here), but when used, it doesn't appear to show up in Instruments.

Is there a way to do this from a C application?

Community
  • 1
  • 1
leecbaker
  • 3,611
  • 2
  • 35
  • 51
  • Very good question. I would like to know the answer too. A similar question was handled here: http://stackoverflow.com/questions/2057960/how-to-set-a-threadname-in-macosx – lukasz Jun 08 '12 at 02:08
  • So `https://developer.apple.com/documentation/foundation/nsthread/1414122-name` won't be enough for you? – manishg Sep 08 '20 at 12:50
  • Are you restricted to Xcode specifically? Also, for pure C applications this is in fact a thing. There is fancy software that does this. – ReverseFlowControl Sep 09 '20 at 03:50

0 Answers0