mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'contrib/github_pr_9497' into 'master'
Move xSemaphoreGive out of configASSERT (GitHub PR) Closes IDFGH-7988 See merge request espressif/esp-idf!19522
This commit is contained in:
commit
c0f5e123c5
@ -1354,11 +1354,12 @@ BaseType_t xRingbufferAddToQueueSetRead(RingbufHandle_t xRingbuffer, QueueSetHan
|
||||
BaseType_t xReturn;
|
||||
portENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
//Cannot add semaphore to queue set if semaphore is not empty. Temporarily hold semaphore
|
||||
BaseType_t xHoldSemaphore = xSemaphoreTake(rbGET_RX_SEM_HANDLE(pxRingbuffer), 0);
|
||||
BaseType_t result = xSemaphoreTake(rbGET_RX_SEM_HANDLE(pxRingbuffer), 0);
|
||||
xReturn = xQueueAddToSet(rbGET_RX_SEM_HANDLE(pxRingbuffer), xQueueSet);
|
||||
if (xHoldSemaphore == pdTRUE) {
|
||||
if (result == pdTRUE) {
|
||||
//Return semaphore if temporarily held
|
||||
configASSERT(xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer)) == pdTRUE);
|
||||
result = xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer));
|
||||
configASSERT(result == pdTRUE);
|
||||
}
|
||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
return xReturn;
|
||||
@ -1380,11 +1381,12 @@ BaseType_t xRingbufferRemoveFromQueueSetRead(RingbufHandle_t xRingbuffer, QueueS
|
||||
BaseType_t xReturn;
|
||||
portENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
//Cannot remove semaphore from queue set if semaphore is not empty. Temporarily hold semaphore
|
||||
BaseType_t xHoldSemaphore = xSemaphoreTake(rbGET_RX_SEM_HANDLE(pxRingbuffer), 0);
|
||||
BaseType_t result = xSemaphoreTake(rbGET_RX_SEM_HANDLE(pxRingbuffer), 0);
|
||||
xReturn = xQueueRemoveFromSet(rbGET_RX_SEM_HANDLE(pxRingbuffer), xQueueSet);
|
||||
if (xHoldSemaphore == pdTRUE) {
|
||||
if (result == pdTRUE) {
|
||||
//Return semaphore if temporarily held
|
||||
configASSERT(xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer)) == pdTRUE);
|
||||
result = xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer));
|
||||
configASSERT(result == pdTRUE);
|
||||
}
|
||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
return xReturn;
|
||||
|
Loading…
Reference in New Issue
Block a user