Chapter 10. Goroutines - Advanced Features
This is the second chapter of this book that deals with goroutines: the most important feature of the Go programming language: as well as channels that greatly improve what goroutines can do, and we will continue this from where we stopped it in Chapter 9,Goroutines - Basic Features.
Thus, you will learn how to use various types of channels, including buffered channels, signal channels, nil channels, and channels of channels! Additionally, you will learn how you can utilize shared memory and mutexes with goroutines as well as how to time out a program when it is taking too long to finish.
Specifically, this chapter will discuss the following topics:
- Buffered channels
- The
select
keyword - Signal channels
- Nil channels
- Channel of channels
- Timing out a program and avoiding waiting forever for it to end
- Shared memory and goroutines
- Using
sync.Mutex
in order to guard shared data - Using
sync.RWMutex
in order to protect your shared data - Changing the code of
dWC.go
from...