⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createtask.c

📁 tornado2.0 for PPC VxWorks socket 源代码
💻 C
字号:
#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("\n!!!%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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -