pthread: Change the default name from <pthread> to <0xyyyyyyyy>

since it's very easy to identify thread through entry pointer

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2021-02-19 17:33:02 +08:00
committed by David Sidrane
parent 72928cebcf
commit 092d23b25d
+3 -12
View File
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <sched.h>
@@ -57,16 +58,6 @@
const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER;
/****************************************************************************
* Private Data
****************************************************************************/
#if CONFIG_TASK_NAME_SIZE > 0
/* This is the name for name-less pthreads */
static const char g_pthreadname[] = "<pthread>";
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -98,8 +89,8 @@ static inline void pthread_argsetup(FAR struct pthread_tcb_s *tcb,
#if CONFIG_TASK_NAME_SIZE > 0
/* Copy the pthread name into the TCB */
strncpy(tcb->cmn.name, g_pthreadname, CONFIG_TASK_NAME_SIZE);
tcb->cmn.name[CONFIG_TASK_NAME_SIZE] = '\0';
snprintf(tcb->cmn.name, CONFIG_TASK_NAME_SIZE,
"pt-%p", tcb->cmn.entry.pthread);
#endif /* CONFIG_TASK_NAME_SIZE */
/* For pthreads, args are strictly pass-by-value; that actual