API of getting thread name

NAME

pthread_setname_np, pthread_getname_np - set/get the name of a thread  

SYNOPSIS

#define _GNU_SOURCE             /* See feature_test_macros(7) */
#include <pthread.h>
int pthread_setname_np(pthread_t thread, const char *name);
int pthread_getname_np(pthread_t thread,
                       const char *name, size_t len);

the pthread_t thread can be obtained by pthread_self()

from: https://www.systutorials.com/docs/linux/man/3-pthread_setname_np/
ref: https://blog.csdn.net/Decisiveness/article/details/58343302

原文地址:https://www.cnblogs.com/aspirs/p/9714886.html