createtask.c
来自「tornado2.0 for PPC 自启动」· C语言 代码 · 共 51 行
C
51 行
#include <vxWorks.h>
#include <stdio.h>
#include <stdlib.h>
#include <taskLib.h>
#include <sysLib.h>
#include "cretetask.h"
#ifdef __cplusplus
extern "C"{
#endif
int tidlist;/*任务ID*/
/*任务入口主函数*/
int testmain(void)
{
int ni = 10;
int nj = 2;
int nsum = ni + nj;
printf("\nthe result = %d\n",nsum);
return 0;
}
/*创建任务函数*/
int test(void)
{
printf("test create begin!\n");
/*创建任务*/
tidlist = taskSpawn("tTest", 90, VX_FP_TASK, 20000,
(FUNCPTR)testmain, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
/*判断任务是否创建成功*/
if (-1 != tidlist)
{
printf("test create ok!\n");
return (0);
}
else
{
printf("test create fail!\n");
return (-1);
}
}
#ifdef __cplusplus
}
#endif /* end of __cplusplus */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?