Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 506 Bytes

README.md

File metadata and controls

20 lines (14 loc) · 506 Bytes

signal

Blocks all blockable signals.

notes

This is useful to prevent being SIGTERMed. It cannot stop SIGKILL or SIGSTOP.

example

Note that the use of sleep 1 is just to avoid the scenario where we actually send SIGTERM before sigprocmask() is invoked.

$ bash -c 'echo Hello; kill -SIGTERM $$; echo Goodbye'
Hello
[1]    29175 terminated  bash -c 'echo Hello; kill -SIGTERM $$; echo Goodbye'
$ ./signal bash -c 'echo Hello; kill -SIGTERM $$; echo Goodbye' 
Hello
Goodbye