uxQueueSpacesAvailableFromISR

microwavesafe wrote on Friday, January 13, 2017:

It would be very useful, in my code, to interrogate the size of a Queue in an ISR. Looking at the code I can’t see why this would be a problem. Is the below code a valid implementation?

UBaseType_t uxQueueSpacesAvailableFromISR( const QueueHandle_t xQueue )
{
UBaseType_t uxReturn;
uxReturn = ( ( Queue_t * ) xQueue )->uxLength - ( ( Queue_t * ) xQueue )->uxMessagesWaiting;
return uxReturn;
}

Can anyone see any potential problems with this? Am I missing something obvious?

rtel wrote on Friday, January 13, 2017:

You can call uxQueueMessagesWaitingFromISR()

cmcqueen1975 wrote on Wednesday, August 07, 2019:

I would find this function very helpful too. I’m surprised it doesn’t already exist.