This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
static int flag = 0;
int cnt = 0;
Void task2(UArg a0, UArg a1)
{
int cnt = 2;
while(cnt--)
{
printf("task2 func\n");
Task_yield();
Task_sleep(10);
}
Task_exit();
}
Void taskFxn(UArg a0, UArg a1)
{
Task_Handle task;
Task_Params params;
Task_Params_init(¶ms);
while(1)
{
if(cnt++ == 5)
{
if(flag == 0)
{
//创建子任务
//......
params.priority = 1;
params.stackSize = 256;
task = Task_create(task2, ¶ms, NULL);
if (task == NULL) {
System_printf("Task_create() failed!\n");
BIOS_exit(0);
}
flag = 1;
}
}
if(cnt > 100)
{
Task_delete(&task);
System_printf("delete task2\n");
}
printf("taskFxn()\n");
Task_yield();
Task_sleep(1);
}
}
/*
* ======== main ========
*/
Int main()
{
Task_Handle task;
Error_Block eb;
Task_Params params;
Task_Params_init(¶ms);
params.stackSize = 3*1024;
params.priority = 5;
System_printf("enter main()\n");
Error_init(&eb);
task = Task_create(taskFxn, ¶ms, &eb);
if (task == NULL) {
System_printf("Task_create() failed!\n");
BIOS_exit(0);
}
BIOS_start(); /* does not return */
return(0);
}
在taskFxn中创建了task2, 为什么创建完了task2后,console只有task2的打印信息而没有taskFxn的打印?