Chapter 7. Concurrency patterns

In this chapter

  • Control the lifetime of programs
  • Manage a pool of resources that can be reused
  • Create a pool of goroutines that can process work

In chapter 6 you learned what concurrency is and how channels behave, and reviewed code that showed concurrency in action. In this chapter you’ll extend that knowledge by reviewing more code. We’ll review three packages that implement different concurrency patterns that you can use in your own projects. Each package provides a practical perspective on the use of concurrency and channels and how they can make concurrent programs easier to write and reason about.

7.1. Runner

The purpose of the runner package is to show how channels can be used to monitor the amount ...

Get Go in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.