arch posix: Implement arch_thread_name_set()
This will update the posix thread names to match the zephyr thread names. This will simplify debugging as the debugger will recognize the thread names. Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
This commit is contained in:
parent
98a16b424a
commit
fb745f610f
6 changed files with 53 additions and 0 deletions
|
@ -25,6 +25,7 @@ void nct_first_thread_start(void *this, int next_allowed_thread_nbr);
|
|||
int nct_new_thread(void *this, void *payload);
|
||||
void nct_abort_thread(void *this, int thread_idx);
|
||||
int nct_get_unique_thread_id(void *this, int thread_idx);
|
||||
int nct_thread_name_set(void *this, int thread_idx, const char *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -60,6 +60,8 @@
|
|||
|
||||
#define NCT_DEBUG_PRINTS 0
|
||||
|
||||
/* For pthread_setname_np() */
|
||||
#define _GNU_SOURCE
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -647,6 +649,14 @@ int nct_get_unique_thread_id(void *this_arg, int thread_idx)
|
|||
return tt_el->thead_cnt;
|
||||
}
|
||||
|
||||
int nct_thread_name_set(void *this_arg, int thread_idx, const char *str)
|
||||
{
|
||||
struct te_status_t *this = (struct te_status_t *)this_arg;
|
||||
struct threads_table_el *tt_el = ttable_get_element(this, thread_idx);
|
||||
|
||||
return pthread_setname_np(tt_el->thread, str);
|
||||
}
|
||||
|
||||
/*
|
||||
* Notes about coverage:
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue