Querying the count value of a counting semaphore

I am running FreeRTOS version 8.2.2 and am wondering why there is no function provided to get the count value of a counting semaphore. While I did find a workaround – cast the handle as a queue handle and use uxQueueMessages Waiting() – it seems like having a dedicated function would be worthwhile. Any thoughts?

Querying the count value of a counting semaphore

Any of the queue functions can be used on semahores too. I can add a “get current count” macro that calls the queue function. Regards.

Querying the count value of a counting semaphore

I think that would be great – particularly if it found its way into the documentation. 🙂

Querying the count value of a counting semaphore

I have added the line:

define xSemaphoreGetCount( xSemaphore ) uxQueueMessagesWaiting( (

QueueHandle_t ) ( xSemaphore ) ) but not checked it in yet. It will get checked in after it has been tested. Regards.