Points To Catch
- Signals = software interrupts.
- The command kill -l on the bash would give us the following.
|
|
- Signals are also delivered to a process with the help of kill command. The manual page (man kill) of kill command says that the default and easier version of kill command is the kill PID. Where PID is the process ID that is found via the ps command. The default signal is SIGTERM (15). Alternatively, a signal number is specified to the kill command such as kill -2 1291 making a delivery of SIGINT(2) signal to the process ID 1291
- Every thread has its own private signal mask(APIs like pthread_sigmask() etc) can be used to capture or block particular signal
- Some of the most important APIs to implement signal mechanisms are
sigaction
, signal andsignalfd
. - signal() does not block other signals from arriving while the current signal is being executed. Thus when more than one signal occur at the same time, it becomes more problematic to understand and perform actions. If it is on the same data, this might even get more complex. The
sigaction()
blocks the other signals while the handler is being executed.
Example
|
|