August 2019
Beginner to intermediate
798 pages
17h 2m
English
The last subsection of this topic illustrates how you can share data using a dedicated goroutine. Although shared memory is the traditional way that threads communicate with each other, Go comes with built-in synchronization features that allow a single goroutine to own a shared piece of data. This means that other goroutines must send messages to this single goroutine that owns the shared data, which prevents the corruption of the data. Such a goroutine is called a monitor goroutine. In Go terminology, this is sharing by communicating instead of communicating by sharing.
The technique will be illustrated using the monitor.go source file, which will be presented in five parts. The monitor.go program generates ...
Read now
Unlock full access