diff --git a/src/platforms/px4_atomic.h b/src/platforms/px4_atomic.h index a5bde13808..be2858ea83 100644 --- a/src/platforms/px4_atomic.h +++ b/src/platforms/px4_atomic.h @@ -80,7 +80,11 @@ public: */ inline T load() const { +#ifdef __PX4_QURT + return _value; +#else return __atomic_load_n(&_value, __ATOMIC_SEQ_CST); +#endif } /** @@ -88,7 +92,11 @@ public: */ inline void store(T value) { +#ifdef __PX4_QURT + _value = value; +#else __atomic_store(&_value, &value, __ATOMIC_SEQ_CST); +#endif } /** @@ -159,7 +167,13 @@ public: } private: +#ifdef __PX4_QURT + // It seems that __atomic_store and __atomic_load are not supported on Qurt, + // so the best that we can do is to use volatile. + volatile T _value; +#else T _value; +#endif }; using atomic_int = atomic;