Skip to content

Commit

Permalink
pthread_cleanup: rm sched_[un]lock
Browse files Browse the repository at this point in the history
Since TLS is only used within a single thread and requires no additional protection.

Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Sep 18, 2023
1 parent b98e78b commit 52b00d3
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions libs/libc/pthread/pthread_cleanup.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ void pthread_cleanup_push(pthread_cleanup_t routine, FAR void *arg)
DEBUGASSERT(tls != NULL);
DEBUGASSERT(tls->tos < CONFIG_PTHREAD_CLEANUP_STACKSIZE);

/* sched_lock() should provide sufficient protection. We only need to
* have this TCB stationary; the pthread cleanup stack should never be
* modified by interrupt level logic.
*/

sched_lock();
if (tls->tos < CONFIG_PTHREAD_CLEANUP_STACKSIZE)
{
unsigned int ndx = tls->tos;
Expand All @@ -153,8 +147,6 @@ void pthread_cleanup_push(pthread_cleanup_t routine, FAR void *arg)
tls->stack[ndx].pc_cleaner = routine;
tls->stack[ndx].pc_arg = arg;
}

sched_unlock();
}

/****************************************************************************
Expand Down

0 comments on commit 52b00d3

Please sign in to comment.