February 2018
Intermediate to advanced
340 pages
9h 43m
English
In an application, where the resources are acquired, a resource leak could happen in the case of an instant termination. It is better to handle the signals and take some necessary steps to release the resources. The preceding code shows the concept of how to do that.
The Notify function from the signal package would be the one that helps us to handle the received signals.
Note that the Notify function of the signal package is communicating with the goroutine by the sChan channel. Notify then catches the defined signals and sends these to goroutine to be handled. Finally, exitChan is used to resolve the exit code of the ...
Read now
Unlock full access