rename xHoldSemaphore to result

This commit is contained in:
tgotic 2022-08-05 10:19:47 +02:00 committed by Darian Leung
parent d96121221d
commit 047d75eee5

View File

@ -1354,12 +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
xHoldSemaphore = xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer));
configASSERT(xHoldSemaphore == pdTRUE);
result = xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer));
configASSERT(result == pdTRUE);
}
portEXIT_CRITICAL(&pxRingbuffer->mux);
return xReturn;
@ -1381,12 +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
xHoldSemaphore = xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer));
configASSERT(xHoldSemaphore == pdTRUE);
result = xSemaphoreGive(rbGET_RX_SEM_HANDLE(pxRingbuffer));
configASSERT(result == pdTRUE);
}
portEXIT_CRITICAL(&pxRingbuffer->mux);
return xReturn;