From 1e31ec8003d4dcf1d37f2d1b55d86292a9c18b53 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Mon, 13 Nov 2023 13:39:12 +0200 Subject: [PATCH] sched/tls_info: Add tl_ prefix to pthread cleanup stack / tos --- include/nuttx/tls.h | 9 +++++---- libs/libc/pthread/pthread_cleanup.c | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/nuttx/tls.h b/include/nuttx/tls.h index 6843cec0eb..cfdf063fec 100644 --- a/include/nuttx/tls.h +++ b/include/nuttx/tls.h @@ -197,12 +197,13 @@ struct tls_info_s #endif #if defined(CONFIG_PTHREAD_CLEANUP_STACKSIZE) && CONFIG_PTHREAD_CLEANUP_STACKSIZE > 0 - /* tos - The index to the next available entry at the top of the stack. - * stack - The pre-allocated clean-up stack memory. + /* tl_tos - The index to the next available entry at the top of the + * stack. + * tl_stack - The pre-allocated clean-up stack memory. */ - uint8_t tos; - struct pthread_cleanup_s stack[CONFIG_PTHREAD_CLEANUP_STACKSIZE]; + uint8_t tl_tos; + struct pthread_cleanup_s tl_stack[CONFIG_PTHREAD_CLEANUP_STACKSIZE]; #endif int tl_errno; /* Per-thread error number */ diff --git a/libs/libc/pthread/pthread_cleanup.c b/libs/libc/pthread/pthread_cleanup.c index 0d73d0f799..9c1aec1f17 100644 --- a/libs/libc/pthread/pthread_cleanup.c +++ b/libs/libc/pthread/pthread_cleanup.c @@ -56,13 +56,13 @@ static void pthread_cleanup_pop_tls(FAR struct tls_info_s *tls, int execute) { - if (tls->tos > 0) + if (tls->tl_tos > 0) { unsigned int ndx; /* Get the index to the last cleaner function pushed onto the stack */ - ndx = tls->tos - 1; + ndx = tls->tl_tos - 1; DEBUGASSERT(ndx >= 0 && ndx < CONFIG_PTHREAD_CLEANUP_STACKSIZE); /* Should we execute the cleanup routine at the top of the stack? */ @@ -73,11 +73,11 @@ static void pthread_cleanup_pop_tls(FAR struct tls_info_s *tls, int execute) /* Yes.. Execute the clean-up routine. */ - cb = &tls->stack[ndx]; + cb = &tls->tl_stack[ndx]; cb->pc_cleaner(cb->pc_arg); } - tls->tos = ndx; + tls->tl_tos = ndx; } } @@ -127,15 +127,15 @@ void pthread_cleanup_push(pthread_cleanup_t routine, FAR void *arg) FAR struct tls_info_s *tls = tls_get_info(); DEBUGASSERT(tls != NULL); - DEBUGASSERT(tls->tos < CONFIG_PTHREAD_CLEANUP_STACKSIZE); + DEBUGASSERT(tls->tl_tos < CONFIG_PTHREAD_CLEANUP_STACKSIZE); - if (tls->tos < CONFIG_PTHREAD_CLEANUP_STACKSIZE) + if (tls->tl_tos < CONFIG_PTHREAD_CLEANUP_STACKSIZE) { - unsigned int ndx = tls->tos; + unsigned int ndx = tls->tl_tos; - tls->tos++; - tls->stack[ndx].pc_cleaner = routine; - tls->stack[ndx].pc_arg = arg; + tls->tl_tos++; + tls->tl_stack[ndx].pc_cleaner = routine; + tls->tl_stack[ndx].pc_arg = arg; } } @@ -159,7 +159,7 @@ void pthread_cleanup_popall(FAR struct tls_info_s *tls) { DEBUGASSERT(tls != NULL); - while (tls->tos > 0) + while (tls->tl_tos > 0) { pthread_cleanup_pop_tls(tls, 1); }