Non-standard pthread_setname_np can't set thread name from other threads.

All major platform pthread APIs except for Apple, provide a pthread_setname_np call that takes a pthread_t handle as the first argument. Even pthread_getname_np takes a pthread_t handle. But Apple, only allows setting the name from within the thread. This means std::thread abstractions in C++ can't or don't provide a reasonable call to set or change the thread name from another thread.

pthread_setname_np(pthread_t thread, const char* name); <- standard api
pthread_setname_np(const char* name); <- Apple's api

Could this be standardized? Given that [NSThread setName:] exists and can perform this function, there must be a way to perform this.

Non-standard pthread_setname_np can't set thread name from other threads.
 
 
Q