Hi experts,
I’m facing a problem that a task can not be scheduled when the task is created in another task. I have tested following scenarios.
Scenario 1:
task0.create(taskFunc0, priority = 4);
start the scheduler;
taskFunc0
{
task1.create(taskFunc1, priority = 10); // taskFunc1 will run
task2.create(taskFunc2, priority = 3); // taskFunc2 will run
}
Scenario 2:
task0.create(taskFunc0, priority = 4);
start the scheduler;
taskFunc0
{
task1.create(taskFunc1, priority = 10); // taskFunc1 will run
task2.create(taskFunc2, priority = 3); // taskFunc2 will not run
task3.create(taskFunc3, priority = 3); // taskFunc3 will run
}
Scenario 3:
task0.create(taskFunc0, priority = 4);
start the scheduler;
taskFunc0
{
task1.create(taskFunc1, priority = 10); // taskFunc1 will run
task2.create(taskFunc2, priority = 3); // taskFunc2 will not run
task3.create(taskFunc3, priority = 3); // taskFunc3 will not run
task4.create(taskFunc4, priority = 6); // taskFunc4 will run
}
Scenario 4:
task0.create(taskFunc0, priority = 4);
start the scheduler;
taskFunc0
{
task1.create(taskFunc1, priority = 10); // taskFunc1 will run
task2.create(taskFunc2, priority = 3); // taskFunc2 will not run
task3.create(taskFunc3, priority = 6); // taskFunc3 will run
}
Scenario 5:
task0.create(taskFunc0, priority = 4);
start the scheduler;
taskFunc0
{
task1.create(taskFunc1, priority = 10); // taskFunc1 will run
task2.create(taskFunc2, priority = 3); // taskFunc2 will run
delay(1s);
task3.create(taskFunc3, priority = 6); // taskFunc3 will run
}
In the above scenarios, all the tasks are statically and successfully, I can see task2’s state is blocked when not run. It is weird that when a task create directly after task2, task2 will not run. Is there any limitation in this scenario? Any rules of task creation I missed?
Thanks a lot for your time.