From b48a01dbc87e10f2666b06c8136290d5e8fae002 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 17 Jan 2024 09:11:26 +1100 Subject: [PATCH] AP_HAL: allow mutexes in bootloader --- libraries/AP_HAL/Semaphores.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/AP_HAL/Semaphores.cpp b/libraries/AP_HAL/Semaphores.cpp index 65890007e2..1ebb9cbe22 100644 --- a/libraries/AP_HAL/Semaphores.cpp +++ b/libraries/AP_HAL/Semaphores.cpp @@ -12,14 +12,18 @@ WithSemaphore::WithSemaphore(AP_HAL::Semaphore *mtx, uint32_t line) : WithSemaphore::WithSemaphore(AP_HAL::Semaphore &mtx, uint32_t line) : _mtx(mtx) { +#ifndef HAL_BOOTLOADER_BUILD bool in_main = hal.scheduler->in_main_thread(); if (in_main) { hal.util->persistent_data.semaphore_line = line; } +#endif _mtx.take_blocking(); +#ifndef HAL_BOOTLOADER_BUILD if (in_main) { hal.util->persistent_data.semaphore_line = 0; } +#endif } WithSemaphore::~WithSemaphore()