2008/6/6 Lee Begg <[EMAIL PROTECTED]>:
> --debug/-d to disable.
>
> Could you add that to the usage output in Settings::printHelp()
Sure thing.
> Also, could you explain this bit.
>
> + else if(pid > 0){
> + alarm(2);
> + pause();
> + exit(1);
> + }
>
> which I know is run by the parent process (connected to the terminal), but why
> alarm, pause then exit. (why not just exit?)
>
> and this bit, why kill the parent?
>
> + kill(parent, SIGUSR1);
I could just exit (with a 0 status instead of 1), but this does a
little more. Here are the possibilities:
1. The child started properly, sent a SIGUSR1, so child_handler() in
the parent returns 0 (success).
2. Tthe child didn't start after 2 seconds elapsed, the system sent a
SIGALRM, so child_handler() in the parent returns 1 (failure).
3. The child process terminated prematurely, sent a SIGCHLD, so
child_handler() in the parent returns 1 (failure).
4. The pause() returns for some reason (unhandled signal), so the
parent returns 1 (failure).
Basically, this just makes it so the parent has some oversight over
the child and returns a proper exit status. Better design in my
opinion, but you're right, it's not really necessary. Verdict?
--
Aaron Mavrinac
www.mavrinac.com
PGP Public Key: http://www.mavrinac.com/pgp.asc
_______________________________________________
tp-devel mailing list
[email protected]
http://www.thousandparsec.net/tp/mailman.php/listinfo/tp-devel