初级会员
- 积分
- 66
- 金钱
- 66
- 注册时间
- 2019-2-2
- 在线时间
- 11 小时
|
3金钱
void task2_task(void *p_arg)
{
u8 task2_num=0;
OS_ERR err;
CPU_SR_ALLOC();
p_arg = p_arg;
POINT_COLOR = BLACK;
OS_CRITICAL_ENTER();
LCD_DrawRectangle(125,110,234,314); //»-ò»¸ö¾ØDÎ
LCD_DrawLine(125,130,234,130); //»-Ïß
POINT_COLOR = BLUE;
LCD_ShowString(126,111,110,16,16,"Task2 Run:000");
OS_CRITICAL_EXIT();
while(1)
{
task2_num++; //èÎÎñ2Ö′DD′Îêy¼ó1 ×¢òatask1_num2¼óμ½255μÄê±oò»áÇåá㣡£¡
LED1=~LED1;
printf("èÎÎñ2òѾ-Ö′DD£o%d′Î\r\n",task2_num);
LCD_ShowxNum(206,111,task2_num,3,16,0x80); //ÏÔê¾èÎÎñÖ′DD′Îêy
LCD_Fill(126,131,233,313,lcd_discolor[13-task2_num%14]); //ìî3äÇøóò
OSTimeDlyHMSM(0,0,1,0,OS_OPT_TIME_HMSM_STRICT,&err); //Ñóê±1s
}
}
想问下
OS_CRITICAL_ENTER();和OS_CRITICAL_EXIT();
进入临界区有什么用呢?
什么时候用进入临界区呢?
while(1)怎么不进入临界区?
|
|