vTaskSetApplicationTaskTag()

oahmad2 wrote on Friday, April 16, 2010:

I was looking at the example on vTaskSetApplicationTaskTag() in the FreeRTOS reference manual and I have a question about the last line in that example (Listing 42):

#define traceTASK_SWITCHED_OUT() xTaskCAllApplicationTaskHook( pxCurrentTCB, 0)

This #define, as I understand it, globally enables all tasks to run their defined registered callbacks.  Am I correct?  If so, what about tasks that do not define a callback?  Does the kernel ‘ignore’ calling the task-hooks of those asks that do not define the hook callbacks  or does it force all tasks to define the hook-callbacks?

davedoors wrote on Friday, April 16, 2010:

If pxCurrentTCB does not have a tag defined then xTaskCallApplicationTaskHook() will return pdFAIL. It is safe.