📄 testostaskrestart.c
字号:
#include "taskTest.h"
static void entry2(
void* argument
)
{
printf("in task entry,the param[%d].\n",(int)argument);
while(1)
OSTaskDelay(10);
}
int testOSTaskRestart()
{
OS_STATUS status;
unsigned32 task_id;
printf("*** test of OSTaskRestart ***\n");
printf("create a tasks.\n");
status = OSTaskCreate("tsk",101,STACK_MINIMUM_SIZE,OS_DEFAULT,OS_DEFAULT,&task_id);
if(status != OS_OK)
{
printf("OSTaskCreate error:[%s]\n",serrno(errno));
return (-1);
}
printf("OSTaskStart to start the task with the param 20.\n");
status = OSTaskStart( task_id, entry2, 20 );
if(status != OS_OK)
{
printf("OSTaskStart error:[%s]\n",serrno(errno));
return (-1);
}
OSTaskDelay(1000);
printf("OSTaskRestart to restart the task with the param 10.\n");
status = OSTaskRestart( task_id, 10 );
if(status != OS_OK)
{
printf("OSTaskRetart error:[%s]\n",serrno(errno));
return (-1);
}
OSTaskDelay(1000);
OSTaskDelete(task_id);
printf("*** OSTaskRestart test OK! ***\n");
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -