#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <alchemy/timer.h>
#include <alchemy/task.h>
//#include</usr/xenomai/include/trank/native/task.h>
RT_TASK hello_task;
// 任务执行的功能函数
void helloWorld(void *arg)
{
RT_TASK_INFO curtaskinfo;
printf("Hello World!\n");
// 询问当前的任务
rt_task_inquire(NULL,&curtaskinfo);
// 打印出任务的名字
printf("Task name : %s \n", curtaskinfo.name);
}
int main(int argc, char* argv[])
{
char str[100];
printf("start task\n");
sprintf(str,"hello");
int erro;
erro=rt_task_create(&hello_task,str, 0, 50, 0);
printf("123=%d\n",erro);
printf("afdkk\n");
erro=rt_task_start(&hello_task, &helloWorld, 0);
printf("%d\n",erro);
return 0;
}
执行效果