void task1_task(void *p_arg)
{
OS_ERR err;
u8 task1_str[]="First task Running!";
while(1)
{
printf("
任务1:
");
LCD_Fill(0,110,239,319,CYAN);
OSSemPend(&MY_SEM,0,OS_OPT_PEND_BLOCKING,0,&err);
memcpy(share_resource,task1_str,sizeof(task1_str));
delay_ms(300);
printf("%s
",share_resource);
OSSemPost (&MY_SEM,OS_OPT_POST_1,&err);
LED0 = ~LED0;
OSTimeDlyHMSM(0,0,1,0,OS_OPT_TIME_PERIODIC,&err);
}
}
task1这个函数中在请求到信号量后,当执行到delay_ms(300);时会不会引发调度函数啊?后面还有个任务二
void task2_task(void *p_arg)
{
OS_ERR err;
u8 task2_str[]="Second task Running!";
while(1)
{
printf("
任务2:
");
LCD_Fill(0,110,239,319,BROWN);
OSSemPend(&MY_SEM,0,OS_OPT_PEND_BLOCKING,0,&err);
memcpy(share_resource,task2_str,sizeof(task2_str));
delay_ms(300);
printf("%s
",share_resource);
OSSemPost (&MY_SEM,OS_OPT_POST_1,&err);
LED1 = ~LED1;
OSTimeDlyHMSM(0,0,1,0,OS_OPT_TIME_PERIODIC,&err);
}
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
printf(" 任务2: ");在任务2中不是在获取任务量函数之前就执行了吗?求解,才刚入门
printf(" 任务2: ");
LCD_Fill(0,110,239,319,BROWN);
OSSemPend(&MY_SEM,0,OS_OPT_PEND_BLOCKING,0,&err);
一周热门 更多>