Hands-On System Programming with Go
上QQ阅读APP看书,第一时间看更新

Signals

Exit codes connect processes and their parents, but signals make it possible to interface any process with another, including itself. They are also asynchronous and unidirectional, but they represent communication from the outside of a process. 

The most common signal is SIGINT, which tells the application to terminate, and can be sent to a foreground process in a shell with the Ctrl + C key combination. However, there are many more options, as shown in the following table:

The kill command allows you to send a signal to any application, and a comprehensive list of available signals can be shown with the -l flag: