in reply to Influencing control flow using a signal handler

Hello folks,

You invested quite a lot of time into my silly problems. :-)

I appreciate this.

@Athanasius: I changed the script accordingly. THX.

@tybalt89: Your solution looks very professional. I think I will borrow one or the other line in later versions (and come back with questions I guess).

But first I would like to understand why my code does not work as expected.

I am able to terminate child number one without problems, but the prog fails to restart the childs. On submitting SIGUSR1 to the parent, the child is killed as expected but the parent as well, as the sample output tells us:

Child two with PID 23317 received a message: 'Parent with process ID 2 +3314 for child two' Child one with PID 23316 received a message: 'Parent with process ID 2 +3314 for child one' The parent process with PID 23314 received a message: 'Child one with +PID 23316' The parent process with PID 23314 received a message: 'Child two with +PID 23317' DEBUG: $restart is 0 Child two with PID 23317 received a message: 'Parent with process ID 2 +3314 for child two' Child one with PID 23316 received a message: 'Parent with process ID 2 +3314 for child one' kill_and_restart: $restart is 0, $pid is 23316 kill_and_restart: $restart is 1

Repeating the test reveals that the program is NOT terminated at the same code line each time, e.g., I was able to get the message "(Re-)Starting ..." as the last line output.

But the expected behaviour is: parent keeps on running, kills the remaining child and gives birth to two new childs.

What do I miss out?

Cheers

Bloedian