Task Creation: Same Function Different Name

darkkingdom wrote on Wednesday, November 04, 2015:

I did two or more task creation with same task_function and different task_name for xTaskCreate();.
And it seems work OK. But I wonder is it OK or are there any potential bugs.

For example.

void TestTask(void *pvParameters)
{
xxxxxxxxxxxxxxx
}

xTaskCreate(
TestTask,“TASK_0”,256,(VOID*)&MSG_OBJECT[0],1,(xTaskHandle*)&task_handle[0]
);

xTaskCreate(
TestTask,“TASK_1”,256,(VOID*)&MSG_OBJECT[1],1,(xTaskHandle*)&task_handle[1]
)

rtel wrote on Wednesday, November 04, 2015:

Each task has its own stack and its own (virtual) set of processor registers - so provided you are not using function scope static variables, what you are doing is fine, and in fact common practice. You can see an example here where three simple LED flash tasks are created from the same function - and the function. The LED to flash could have been passed into the task function using the function parameter: https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Demo/Common/Minimal/flash.c