Unverified Commit 5204dab9 authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Fix CoreMutex FreeRTOS ISR logic (#1510)

parent 273fb84d
......@@ -30,10 +30,15 @@ CoreMutex::CoreMutex(mutex_t *mutex, uint8_t option) {
_option = option;
if (__isFreeRTOS) {
auto m = __get_freertos_mutex_for_ptr(mutex);
if (__freertos_check_if_in_isr() && !__freertos_mutex_take_from_isr(m)) {
return;
if (__freertos_check_if_in_isr()) {
if (!__freertos_mutex_take_from_isr(m)) {
return;
}
// At this point we have the mutex in ISR
} else {
// Grab the mutex normally, possibly waking other tasks to get it
__freertos_mutex_take(m);
}
__freertos_mutex_take(m);
} else {
uint32_t owner;
if (!mutex_try_enter(_mutex, &owner)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment