The code snippet below creates two tasks, that is trying to print the word. Task 2 is created with a higher priority. Because both tasks run in an infinite cycle and do not give up voluntarily start time, then Task 1 will never get (start time...If that's the right word).
How can i modify "Task 2" callback-function, that "Task 1" will also get start time ?
void vTaskFunction ( void *pvParameters ) {
for( ;; ) {
vPrintString((char *) pvParameters );
}
}
static const char *pcTextForTask1 = "Task 1 is running\r\n";
static const char *pcTextForTask2 = "Task 2 is running\r\n";
int main( void ) {
/* ...MCU initialization...*/
xTaskCreate( vTaskFunction, "Task 1", 1000, (void*)pcTextForTask1, 1, NULL ); // Task with priority 1
xTaskCreate( vTaskFunction, "Task 2", 1000, (void*)pcTextForTask2, 2, NULL ); // Task with priority 2
vTaskStartScheduler();
for( ;; );
}
I hope it's make sense