Assert uxCountValue > 0 in xQueueCreateCountingSemaphore

beginend1 wrote on Thursday, November 07, 2013:

It can be usefull to add some checking in xQueueCreateCountingSemaphore() against uxCountValue == 0. If you make a mistake and gives 0 when creating counting semaphore as max value the xQUEUE::uxMessagesWaiting will underflow when you use xSemaphoreTakeXXX() There is long way to truck this kind of bugs :frowning:

rtel wrote on Thursday, November 07, 2013:

The following two lines have been added on entry to the function:

configASSERT( uxMaxCount != 0 );
configASSERT( uxInitialCount <= uxMaxCount );

Regards.