pthread/spinlock: Call up_testsest directly in the flat build
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
0a1ac4762a
commit
ba6ee2a407
@ -9,8 +9,8 @@ menu "pthread support"
|
|||||||
config PTHREAD_SPINLOCKS
|
config PTHREAD_SPINLOCKS
|
||||||
bool "pthread spinlock support"
|
bool "pthread spinlock support"
|
||||||
default n
|
default n
|
||||||
depends on SPINLOCK && BOARDCTL
|
depends on SPINLOCK && (BUILD_FLAT || BOARDCTL)
|
||||||
select BOARDCTL_TESTSET
|
select BOARDCTL_TESTSET if !BUILD_FLAT
|
||||||
---help---
|
---help---
|
||||||
Enable support for pthread spinlocks.
|
Enable support for pthread spinlocks.
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/boardctl.h>
|
#include <sys/boardctl.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -184,7 +185,11 @@ int pthread_spin_lock(pthread_spinlock_t *lock)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_BUILD_FLAT
|
||||||
|
ret = up_testset(&lock->sp_lock) == SP_LOCKED ? 1 : 0;
|
||||||
|
#else
|
||||||
ret = boardctl(BOARDIOC_TESTSET, (uintptr_t)&lock->sp_lock);
|
ret = boardctl(BOARDIOC_TESTSET, (uintptr_t)&lock->sp_lock);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
while (ret == 1);
|
while (ret == 1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user