September 2017
Intermediate to advanced
466 pages
9h 33m
English
In Chapter 8, Processes and Signals, you saw how Go handles Unix signals using many examples including h1s.go. However, now that you understand more about goroutines and channels, it is time to explain the Go code of h1s.go a little more.
As you already know that h1s.go uses channels and goroutines, it should be clear now that the anonymous function that is executed as a goroutine reads from the sigs channel using an infinite for loop. This means that each time there is a signal that interests us, the goroutine will read it from the sigs channel and handle it.
Read now
Unlock full access