Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libs/libc/pthread/Kconfig
Original file line number Diff line number Diff line change
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
5 changes: 5 additions & 0 deletions libs/libc/pthread/pthread_spinlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <sys/types.h>
#include <sys/boardctl.h>
#include <nuttx/spinlock.h>

#include <assert.h>
#include <errno.h>
Expand Down Expand Up @@ -184,7 +185,11 @@ int pthread_spin_lock(pthread_spinlock_t *lock)

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);
#endif
}
while (ret == 1);

Expand Down