新手入门
- 积分
- 17
- 金钱
- 17
- 注册时间
- 2019-8-19
- 在线时间
- 7 小时
|
1金钱
请问 :互斥信号量的例程的问题 模拟占用信号量用一毫秒系统延时
//μíóÅÏ輶èÎÎñμÄèÎÎñoˉêy
void low_task(void *p_arg)
{
static u32 times;
OS_ERR err;
while(1)
{
OSSemPend(&TEST_SEM,0,OS_OPT_PEND_BLOCKING,0,&err); //ÇëÇóDÅoÅá¿
printf("low task Running!\r\n");
for(times=0;times<5000 ;times++)
{
OSTimeDlyHMSM(0,0,0,1,OS_OPT_TIME_PERIODIC,&err); //Ñóê±1s //·¢ÆeèÎÎñμ÷¶è
}
OSSemPost(&TEST_SEM,OS_OPT_POST_1,&err);
OSTimeDlyHMSM(0,0,1,0,OS_OPT_TIME_PERIODIC,&err); //Ñóê±1s
}
}
实验现象
[18:30:04.316]收←◆ LCD ID:9341
[18:30:04.622]收←◆middle task Running!
low task Running!
[18:30:05.105]收←◆high task Pend Sem
high task Running!
[18:30:05.626]收←◆middle task Running!
low task Running!
[18:30:06.106]收←◆high task Pend Sem
high task Running!
[18:30:06.626]收←◆middle task Running!
low task Running!
[18:30:07.106]收←◆high task Pend Sem
high task Running!
[18:30:07.626]收←◆middle task Running!
low task Running!
[18:30:08.106]收←◆high task Pend Sem
high task Running!
高中低任务都可以一直顺利运行 这是为什么呢?
|
|