pthread: copy priority inheritance fix from espressif
commit 202e6c8984255b551e29e3182e091cf7cd0153b0
This commit is contained in:
parent
d59ed8bba0
commit
a5ee881789
|
@ -591,12 +591,15 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex)
|
||||||
return EBUSY;
|
return EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FreeRTOS mutex must not be deleted while taken (breaks priority inheritance):
|
if (mux->type == PTHREAD_MUTEX_RECURSIVE) {
|
||||||
vTaskSuspendAll();
|
res = xSemaphoreGiveRecursive(mux->sem);
|
||||||
pthread_mutex_unlock(mutex);
|
} else {
|
||||||
|
res = xSemaphoreGive(mux->sem);
|
||||||
|
}
|
||||||
|
if (res != pdTRUE) {
|
||||||
|
assert(false && "Failed to release mutex!");
|
||||||
|
}
|
||||||
vSemaphoreDelete(mux->sem);
|
vSemaphoreDelete(mux->sem);
|
||||||
xTaskResumeAll();
|
|
||||||
|
|
||||||
free(mux);
|
free(mux);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue