keep check hal comp is exist problem

More
25 May 2018 09:29 #111107 by ccaayyww
I wrote a hal,need to keep running.
in hal main()
{
restart:
id=hal_init("testhal");
..
hal_ready(id);
while(1)
{
...
n=hal_comp_name(id);
if(n==NULL)
{
printf("restart testhal");
goto restart;
}
}
hal_exit(id);
}

and run it and linuxcnc.
but when shutdown linuxcnc,and testhal it unload.
run halcmd show comp,there isn't anything but halcmd.but don't get "restart testhal"output.
and try change hal_comp_name to hal_init
in hal main()
{
restart:
id=hal_init("testhal");
..
hal_ready(id);
while(1)
{
...
i=hal_init("testhal");
if(i>0)
{
printf("restart testhal");
goto restart;
}
}
hal_exit(id);
}
and keep get output "HAL ERROR:duplicate component name testhal"and there isn't string "restart testhal"
where is the problem?

Please Log in or Create an account to join the conversation.

More
29 May 2018 13:33 - 29 May 2018 13:34 #111260 by andypugh
Can you re-post the code in code tags so that it is legible? (You can type them, or there is a button in the editor bar)
Last edit: 29 May 2018 13:34 by andypugh.

Please Log in or Create an account to join the conversation.

Time to create page: 0.089 seconds
Powered by Kunena Forum