mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 03:34:32 +02:00
Move xSemaphoreGive out of configASSERT
xSemaphoreGive won't be executed in configASSERT and semaphore will stay locked if NDEBUG (idf v5) or CONFIG_FREERTOS_ASSERT_DISABLE (idf v3, v4) are defined.
This commit is contained in:
@@ -1358,7 +1358,8 @@ BaseType_t xRingbufferAddToQueueSetRead(RingbufHandle_t xRingbuffer, QueueSetHan
|
|||||||
xReturn = xQueueAddToSet(rbGET_RX_SEM_HANDLE(pxRingbuffer), xQueueSet);
|
xReturn = xQueueAddToSet(rbGET_RX_SEM_HANDLE(pxRingbuffer), xQueueSet);
|
||||||
if (xHoldSemaphore == pdTRUE) {
|
if (xHoldSemaphore == pdTRUE) {
|
||||||
//Return semaphore if temporarily held
|
//Return semaphore if temporarily held
|
||||||
configASSERT(xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer)) == pdTRUE);
|
xHoldSemaphore = xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer));
|
||||||
|
configASSERT(xHoldSemaphore == pdTRUE);
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||||
return xReturn;
|
return xReturn;
|
||||||
@@ -1384,7 +1385,8 @@ BaseType_t xRingbufferRemoveFromQueueSetRead(RingbufHandle_t xRingbuffer, QueueS
|
|||||||
xReturn = xQueueRemoveFromSet(rbGET_RX_SEM_HANDLE(pxRingbuffer), xQueueSet);
|
xReturn = xQueueRemoveFromSet(rbGET_RX_SEM_HANDLE(pxRingbuffer), xQueueSet);
|
||||||
if (xHoldSemaphore == pdTRUE) {
|
if (xHoldSemaphore == pdTRUE) {
|
||||||
//Return semaphore if temporarily held
|
//Return semaphore if temporarily held
|
||||||
configASSERT(xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer)) == pdTRUE);
|
xHoldSemaphore = xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer));
|
||||||
|
configASSERT(xHoldSemaphore == pdTRUE);
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||||
return xReturn;
|
return xReturn;
|
||||||
|
Reference in New Issue
Block a user