How can i get state of task in freeRTOS?

jayeshbhoi wrote on Wednesday, October 08, 2014:

I want to know current state of task and i found somthing in below link

http://www.freertos.org/a00021.html

But in my freertos source there is no function named eTaskGetState but there is one function named eTaskStateGet in task.h file and also this function not defined. it is declared as follows

eTaskState eTaskStateGet( xTaskHandle pxTask ) PRIVILEGED_FUNCTION;

so how can i get state of task?

rtel wrote on Wednesday, October 08, 2014:

I presume you are using an old version of FreeRTOS - but the function you found should still work (even though it was renamed some time ago) and you may even find there is a

#define
that maps the old name to the new name.

As you are posting this I assume you tried calling the function but it didn’t work? If so please let us know what the issue was.

Regards.

jayeshbhoi wrote on Wednesday, October 08, 2014:

i am using freeRTOS version 7.3.0 and yes, i tried to calling function eTaskStateGet but it give error like

undefined reference to eTaskStateGet.

where i can found defination of that function?

rtel wrote on Wednesday, October 08, 2014:

…did you set INCLUDE_eTaskGetState (or INCLUDE_eTaskStateGet) to 1 in
FreeRTOSConfig.h? Have a look at the function in the source code.

Regards.

jayeshbhoi wrote on Wednesday, October 08, 2014:

Ok got it and now error is gone. Thanks for your support.