#include "VxWorks.h"
#include "stdio.h"
#include
#include
#include "logLib.h"
#include "kernelLib.h"
int tid1;
int tid2;
void task1()
{
int i = 0;
while (1)
{
logMsg("i'm task 1!\n",0,0,0,0,0,0);
taskDelay(10);
}
}
void task2()
{
int i = 0;
while (1)
{
logMsg("i'm task 2!\n",0,0,0,0,0,0);
taskDelay(10);
}
}
void userStart()
{
printf("userStart\n");
kernelTimeSlice(sysClkRateGet()); /*时间片不为零则为时间片轮转调度,为零则为优先级抢占*/
tid1 = taskSpawn("newtask1", 200, 0, 10000, (FUNCPTR) task1, 0,0,0,0,0,0,0,0,0,0);
tid2 = taskSpawn("newtask2", 200, 0, 10000, (FUNCPTR) task2, 0,0,0,0,0,0,0,0,0,0);
}
void userStop()
{
printf("userStop\n");
taskDelete(tid1);
taskDelete(tid2);
}
阅读(2592) | 评论(0) | 转发(0) |