sched/tls_info: Add tl_ prefix to pthread cleanup stack / tos

This commit is contained in:
Ville Juven 2023-11-13 13:39:12 +02:00 committed by Xiang Xiao
parent 64cf63475c
commit 1e31ec8003
2 changed files with 16 additions and 15 deletions

View File

@ -197,12 +197,13 @@ struct tls_info_s
#endif #endif
#if defined(CONFIG_PTHREAD_CLEANUP_STACKSIZE) && CONFIG_PTHREAD_CLEANUP_STACKSIZE > 0 #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. /* tl_tos - The index to the next available entry at the top of the
* stack - The pre-allocated clean-up stack memory. * stack.
* tl_stack - The pre-allocated clean-up stack memory.
*/ */
uint8_t tos; uint8_t tl_tos;
struct pthread_cleanup_s stack[CONFIG_PTHREAD_CLEANUP_STACKSIZE]; struct pthread_cleanup_s tl_stack[CONFIG_PTHREAD_CLEANUP_STACKSIZE];
#endif #endif
int tl_errno; /* Per-thread error number */ int tl_errno; /* Per-thread error number */

View File

@ -56,13 +56,13 @@
static void pthread_cleanup_pop_tls(FAR struct tls_info_s *tls, int execute) 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; unsigned int ndx;
/* Get the index to the last cleaner function pushed onto the stack */ /* 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); DEBUGASSERT(ndx >= 0 && ndx < CONFIG_PTHREAD_CLEANUP_STACKSIZE);
/* Should we execute the cleanup routine at the top of the stack? */ /* 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. */ /* Yes.. Execute the clean-up routine. */
cb = &tls->stack[ndx]; cb = &tls->tl_stack[ndx];
cb->pc_cleaner(cb->pc_arg); 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(); FAR struct tls_info_s *tls = tls_get_info();
DEBUGASSERT(tls != NULL); 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->tl_tos++;
tls->stack[ndx].pc_cleaner = routine; tls->tl_stack[ndx].pc_cleaner = routine;
tls->stack[ndx].pc_arg = arg; tls->tl_stack[ndx].pc_arg = arg;
} }
} }
@ -159,7 +159,7 @@ void pthread_cleanup_popall(FAR struct tls_info_s *tls)
{ {
DEBUGASSERT(tls != NULL); DEBUGASSERT(tls != NULL);
while (tls->tos > 0) while (tls->tl_tos > 0)
{ {
pthread_cleanup_pop_tls(tls, 1); pthread_cleanup_pop_tls(tls, 1);
} }