Go for Infrastructure
WaitGroups
A WaitGroup lets a caller wait for a set of tasks to finish.
What you will be able to do
- Explain the example and its assumptions
- Use the failure signal to choose a next check
What is in the lesson
- A real situation where this goes wrong
- How it works, step by step
- A command to try yourself
- How it fails in production, and how to tell
- Three quiz questions with explanations
Read this lessonFree. No account needed.
More in Go for Infrastructure
- Select fairnessBeginner · 4 min
A Go select chooses one ready communication; source order is not priority.
- Context cancellationBeginner · 4 min
A Go context communicates cancellation and deadlines to code that observes it.
- Mutex and RWMutexBeginner · 4 min
A mutex coordinates access to shared state; an RWMutex permits multiple readers or one writer.
- Atomic operationsBeginner · 4 min
sync/atomic performs a read-modify-write on one value as a single indivisible operation.
- Race detectorBeginner · 4 min
Go’s race detector reports certain unsynchronized accesses in code paths exercised by a run.
- Worker poolsBeginner · 4 min
A worker pool bounds concurrency with a fixed number of goroutines reading jobs from one channel.