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()