Skip to content

Glossary: Go Beyond the Basics

mutex

Also written: sync.Mutex, mutual exclusion, Lock, Unlock

A lock that lets one goroutine at a time into a critical section. `mu.Lock()` waits if someone holds it, and `defer mu.Unlock()` releases it. It prevents the shop from overselling.

Where the book teaches it

Related terms

critical sectionRWMutexdata raceatomic