Canonical guidance

Use when

Avoid

Preferred pattern

mu := sync.Mutex{}
cond := sync.NewCond(&mu)
ready := false

mu.Lock()
for !ready {
	cond.Wait()
}
mu.Unlock()

Anti-pattern

Explanation: This anti-pattern is tempting because wake-ups feel definitive, but the real contract is the shared condition, not the wake-up event itself.

Why

Related pages

Sources