Commit 88d2f789 authored by baujc's avatar baujc

Improvee detection of multiple PPSi running instances

When /etc/init.d/ppsi.sh is called with the parameter 'restart', it
happens sometimes that the restarted PPSI process detects that another
one is running but it is not really the case. To  sove this problem, the
PPSI process is now  checking  few times with a delay in between before
to decide to exit.
parent d8dfb539
......@@ -139,11 +139,23 @@ int main(int argc, char **argv)
/* check if pid is 0 (shm not filled) or process with provided
* pid does not exist (probably crashed) */
if ((ppsi_head->pid != 0) && (kill(ppsi_head->pid, 0) == 0)) {
wrs_shm_put(ppsi_head);
pp_printf("Fatal: There is another PPSi instance running. "
"Exit...\n\n");
exit(1);
{
int nbTry=1;
while ( nbTry >= 0 ) {
if ((ppsi_head->pid != 0) && (kill(ppsi_head->pid, 0) == 0)) {
nbTry--;
sleep(1);
}
else
break;
}
if ( nbTry<0 ) {
wrs_shm_put(ppsi_head);
pp_printf("Fatal: There is another PPSi instance running. "
"Exit...\n\n");
exit(1);
}
}
/* try connecting to HAL multiple times in case it's still not ready */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment