From baa3641d5f8e64288f45432d6e4989701dbbcc0f Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Thu, 17 Oct 2024 09:31:12 +0530 Subject: msm8996-common: Import newer GPS stack from xiaomi_msm8996-common Change-Id: I5afe78048c4af3648b2d267d71a58b63b9decbc9 --- gps/utils/LocSharedLock.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'gps/utils/LocSharedLock.h') diff --git a/gps/utils/LocSharedLock.h b/gps/utils/LocSharedLock.h index 7fe6237..a7af35e 100644 --- a/gps/utils/LocSharedLock.h +++ b/gps/utils/LocSharedLock.h @@ -30,10 +30,28 @@ #define __LOC_SHARED_LOCK__ #include +#ifndef FEATURE_EXTERNAL_AP #include +#endif /* FEATURE_EXTERNAL_AP */ #include -// This is a utility created for use cases such that there are more than +#ifdef FEATURE_EXTERNAL_AP +#include + +inline int32_t android_atomic_inc(volatile int32_t *addr) +{ + volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr; + return std::atomic_fetch_add_explicit(a, 1, std::memory_order_release); +} + +inline int32_t android_atomic_dec(volatile int32_t *addr) +{ + volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr; + return std::atomic_fetch_sub_explicit(a, 1, std::memory_order_release); +} + +#endif /* FEATURE_EXTERNAL_AP */ + // This is a utility created for use cases such that there are more than // one client who need to share the same lock, but it is not predictable // which of these clients is to last to go away. This shared lock deletes // itself when the last client calls its drop() method. To add a cient, -- cgit v1.2.3