?? testostimercancel.c
字號:
#include "timerTest.h"
void t_entry(unsigned32 id , void *data)
{
printk("\n\n\n\n[%s]\n",data);
}
int testOSTimerCancel()
{
OS_STATUS status;
unsigned32 t_id;
printf("*** test of OSTimerCancel ***\n");
printf("create a timer.\n");
status = OSTimerCreate ("TIMER" , &t_id);
if (status != OS_OK)
{
printf("OSTimerCreate error:[%s]\n",serrno(errno));
return -1;
}
printf("fire the timer for 5000 ticks.\n");
status = OSTimerFireAfter (t_id , 5000 , t_entry , "hello");
if (status != OS_OK)
{
printf("OSTimerFireAfter error:[%s]\n",serrno(errno));
return -1;
}
printf("task Delay 4000 ticks,then cancel the timer.\n");
OSTaskDelay(4000);
status = OSTimerCancel (t_id);
if (status != OS_OK)
{
printf("OSTimerCancel error:[%s]\n",serrno(errno));
return -1;
}
else
printf("OSTimerCancel OK\n");
printf("task Delay 2000 ticks\n");
OSTaskDelay(2000);
OSTimerDelete (t_id);
printf("*** OSTimerCancel test OK! ***\n");
return 1;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -