【thread】windows设置线程名字

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

  • std thread 官方没有这个api
  • linux一般用pthread_getthreadid_np 或者 prctl 来解决。

pthread_getthreadid_np

pthread_getthreadid_np wasn’t on my Mac os x. pthread_t is an opaque type. Don’t beat your head over it. Just assign it to void* and call it good. If you need to printf use %p.

linux 似乎很容易

  • 比如:

pthread_setname_np(pthread_self(), "Specific name");

microsoft 的文档

<
阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: windows