我用 Xenomai API 编写了一个带有无限循环的 hello world 程序,如下所示: 这很快就会终止。
我实际上想通过latencytop
.
如何实时运行无限循环?
RT_TASK demo_task;
void demo(void *arg)
{
RT_TASK *curtask;
RT_TASK_INFO curtaskinfo;
curtask=rt_task_self();
rt_task_inquire(curtask,&curtaskinfo);
printf("Task name : %s \n", curtaskinfo.name);
//------------------ hello world --------------------
while (1)
{
printf("Hello World!\n");
}
}
int main(int argc, char* argv[])
{
char str[10];
rt_print_auto_init(1);
mlockall(MCL_CURRENT|MCL_FUTURE);
printf("start task\n");
sprintf(str,"hello");
rt_task_create(&demo_task, str, 0, 50, 0);
rt_task_start(&demo_task, &demo, 0);
}