Lesson 31. Concurrent state
After reading lesson 31, you’ll be able to
- Keep state safe
- Use mutexes and reply channels
- Employ service loops
Here we are back in the gopher factory. The busy gophers are still building things, but several of the production lines are running low on stock, so they need to order more.
Unfortunately, this is an old-fashioned factory that only has a single shared phone landline to the outside world. All the production lines have their own handset, though. A gopher picks up the phone to place an order, but as she starts speaking, another gopher picks up another handset and starts dialing, interfering with the first gopher. Then another does the same thing and they all get very confused and none of them manage to ...
Get Get Programming with Go 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.