From 4b3b32478a6816888fe34ff60de12dbb043fa6a4 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 19 Feb 2021 17:33:02 +0800 Subject: [PATCH] pthread: Change the default name from to <0xyyyyyyyy> since it's very easy to identify thread through entry pointer Signed-off-by: Xiang Xiao --- sched/pthread/pthread_create.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c index 1b836f50a0b..6893c76a41e 100644 --- a/sched/pthread/pthread_create.c +++ b/sched/pthread/pthread_create.c @@ -57,16 +57,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[] = ""; -#endif - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -98,8 +88,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