Skip to content

Commit

Permalink
pthread/spinlock: Call up_testsest directly in the flat build
Browse files Browse the repository at this point in the history
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
  • Loading branch information
xiaoxiang781216 committed May 19, 2022
1 parent 753aa98 commit 3e09c2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/libc/pthread/Kconfig
Expand Up @@ -9,8 +9,8 @@ menu "pthread support"
config PTHREAD_SPINLOCKS
bool "pthread spinlock support"
default n
depends on SPINLOCK && BOARDCTL
select BOARDCTL_TESTSET
depends on SPINLOCK && (BUILD_FLAT || BOARDCTL)
select BOARDCTL_TESTSET if !BUILD_FLAT
---help---
Enable support for pthread spinlocks.

Expand Down
4 changes: 4 additions & 0 deletions libs/libc/pthread/pthread_spinlock.c
Expand Up @@ -184,7 +184,11 @@ int pthread_spin_lock(pthread_spinlock_t *lock)

do
{
#ifdef CONFIG_BUILD_FLAT
ret = up_testset(lock) == SP_LOCKED ? 1 : 0;
#else
ret = boardctl(BOARDIOC_TESTSET, (uintptr_t)&lock->sp_lock);
#endif
}
while (ret == 1);

Expand Down

0 comments on commit 3e09c2c

Please sign in to comment.