Notify request for API to check if task is waiting for Notify

lantczak wrote on Friday, December 14, 2018:

Hi,
I need API to check if task is blocked due to waiting for notification.
I wrote below API.

#if( configUSE_TASK_NOTIFICATIONS == 1 )

	BaseType_t xTaskNotifyIsTaskWaiting( TaskHandle_t xTask )
	{
	TCB_t *pxTCB;
	BaseType_t xReturn = pdFALSE;

		/* If null is passed in here then it is the calling task that is having
		its notification state cleared. */
		pxTCB = prvGetTCBFromHandle( xTask );

		taskENTER_CRITICAL();
		{
			if( pxTCB->ucNotifyState == taskWAITING_NOTIFICATION )
			{
				xReturn = pdTRUE;
			}
		}
		taskEXIT_CRITICAL();

		return xReturn;
	}

#endif /* configUSE_TASK_NOTIFICATIONS */

Please check if you see any issues with this code and would be nice if you will add it to official release. Official version could be changed to get notify status of task so API will return:

/* Values that can be assigned to the ucNotifyState member of the TCB. */
#define taskNOT_WAITING_NOTIFICATION	( ( uint8_t ) 0 )
#define taskWAITING_NOTIFICATION		( ( uint8_t ) 1 )
#define taskNOTIFICATION_RECEIVED		( ( uint8_t ) 2 )

It is more general and therefroe more useful for other users