DSP

任务挂起和恢复

2019-07-13 19:48发布

2、任务挂起和恢复 (1)OSTaskSuspend流程图 (2)OSTaskResume流程图 (3)测试  /* App1Task */ void App1Task(void *p_arg) {     p_arg = p_arg;       while(1)     {        printf("Hello,I amTask1! ");          OSTimeDlyHMSM(0, 0, 1, 0);                             /* 任务调度*/ } /* App2Task */ void App2Task(void *p_arg) {     p_arg = p_arg;       while(1)     {        printf("Task2 isrunning! ");        if(task2_time == 2)         {            OSTaskSuspend(App1Task_Prio);   /* Task2运行2次挂起Task1任务,会进行任务调度*/        }        else if(task2_time== 10)                                            {            OSTaskResume(App1Task_Prio);    /* Task2运行10次后恢复Task1任务运行,会进行任务调度*/        }        task2_time++;                         /* 计数值加*/                                                OSTimeDlyHMSM(0, 0, 2, 0);         /* 任务调度*/ } 运行结果