From 0d2578dca985e4682197bf07b7d63e513dcc1578 Mon Sep 17 00:00:00 2001 From: David Thacher Date: Sun, 17 Dec 2023 17:51:55 +0000 Subject: [PATCH] Make fields within mutex volatile, just in case it matters. --- src/common/pico_sync/include/pico/mutex.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/pico_sync/include/pico/mutex.h b/src/common/pico_sync/include/pico/mutex.h index bcb3e99e3..b7d36a9e1 100644 --- a/src/common/pico_sync/include/pico/mutex.h +++ b/src/common/pico_sync/include/pico/mutex.h @@ -46,10 +46,10 @@ extern "C" { */ typedef struct __packed_aligned { lock_core_t core; - lock_owner_id_t owner; //! owner id LOCK_INVALID_OWNER_ID for unowned - uint8_t enter_count; //! ownership count + volatile lock_owner_id_t owner; //! owner id LOCK_INVALID_OWNER_ID for unowned + volatile uint8_t enter_count; //! ownership count #if PICO_MUTEX_ENABLE_SDK120_COMPATIBILITY - bool recursive; + volatile bool recursive; #endif } recursive_mutex_t; @@ -59,7 +59,7 @@ typedef struct __packed_aligned { #if !PICO_MUTEX_ENABLE_SDK120_COMPATIBILITY typedef struct __packed_aligned mutex { lock_core_t core; - lock_owner_id_t owner; //! owner id LOCK_INVALID_OWNER_ID for unowned + volatile lock_owner_id_t owner; //! owner id LOCK_INVALID_OWNER_ID for unowned } mutex_t; #else typedef recursive_mutex_t mutex_t; // they are one and the same when backwards compatible with SDK1.2.0