1

Suppose I have the following bash

chld_handler() {
    trap '' CHLD # ignore while we handle
    echo "$(date)" # this won't trigger chld now
    trap 'chld_handler' CHLD # restore
}

# I want to be notified of the exit of any of these processes
xterm &
xterm &
xterm &

trap 'chld_handler' CHLD # first time setup

What would happen if one of the job processes exits, the chld_handler is invoked and while the handler runs another of the job processes exits? Will the second CHLD signal be queued?

Dean
  • 6,610
  • 6
  • 40
  • 90

0 Answers0