I wrote a Perl program which forks and calls a background program in the child process and has a endless while loop which does some stuff in the parent process. Now the while loop should be left when the background program in the child process terminates:
$pid = fork();
if ( !$pid ) {
exec( "program args" );
} else {
while ( 1 ) {
# do something
# needs help: if program terminated, break
}
}