how to set a threadname in MacOSX

后端 未结 2 1804
礼貌的吻别
礼貌的吻别 2021-01-01 17:57

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

相关标签:
2条回答
  • 2021-01-01 18:07

    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)

    0 讨论(0)
  • 2021-01-01 18:25

    Which version of Xcode are you using? Thread names are only supported in Mac OS X 10.6 and Xcode 3.2.

    0 讨论(0)
提交回复
热议问题