mirror of https://github.com/ArduPilot/ardupilot
AP_HAL: allow mutexes in bootloader
This commit is contained in:
parent
07fee626d9
commit
b48a01dbc8
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue