previous | start | next

Blocking Signals

Most signals can be temporarily blocked in order to complete a task like adding the job to the job list. The signal remains pending and will be cause the handler to execute when then signal is unblocked.

The sigprocmask system call provides this functionality.

It can block/unblock a set of signals, but we only need a set consisting of SIGCHLD.

Note that if the command is not builtin, the parent will fork a child. In this case, the parent should block SIGCHLD before the call to fork.

The parent and child must each unblock SIGCHLD. For example, the child cannot unblock SIGCHLD for the parent.



previous | start | next