From f5925c766e0eef8329bbda3970e89f159fc0992f Mon Sep 17 00:00:00 2001 From: Jan Breig Date: Thu, 25 Jun 2026 05:50:12 +0200 Subject: [PATCH] Add spinlock shim for Android NDK builds Fixes compiler errors on missing spinlock when building with Android NDK. --- client/src/cmdparser.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/client/src/cmdparser.c b/client/src/cmdparser.c index 5cfbf58b8..76c28118a 100644 --- a/client/src/cmdparser.c +++ b/client/src/cmdparser.c @@ -30,6 +30,24 @@ # include "pthread_spin_lock_shim.h" // spinlock shim for OSX .. #endif +#ifdef __ANDROID__ +//Spinlock patch for building with Android NDK + +typedef pthread_mutex_t pthread_spinlock_t; + +#define pthread_spin_init(lock, pshared) \ + pthread_mutex_init(lock, NULL) + +#define pthread_spin_lock(lock) \ + pthread_mutex_lock(lock) + +#define pthread_spin_unlock(lock) \ + pthread_mutex_unlock(lock) + +#define pthread_spin_destroy(lock) \ + pthread_mutex_destroy(lock) +#endif + #define MAX_PM3_INPUT_ARGS_LENGTH 4096 bool AlwaysAvailable(void) {